メールの受信:送信と信頼
Set Trust
送信者を信頼済みまたは信頼しないに設定するか、デフォルトに戻します。
POST
https://g.sendcorex.com/v1command: set_trustdefaultで判断を削除します。メッセージをSpamに移すと、その送信者もuntrustedになります。
emailsで多くの送信者をまとめて更新できます。たとえばmoveでSpamから出したときに返るsenderの値です。ゲストにはrules権限が必要です。
引数
idstring任意メッセージid。その会話の外部送信者を使います。
from_emailstring任意送信者のメールアドレス。これか
idを使います。emailsstring[]任意送信者のメールアドレスを最大100件。レスポンスは一括形式で、メールアドレスごとに1件。
valuestring必須default、trusted、untrusted。
クイックスタート
import axios from 'axios';
const response = await axios.post(
'https://g.sendcorex.com/v1',
{
commands: [
{
command: "set_trust",
args: {
from_email: "client@example.com",
value: "trusted"
}
}
]
},
{ headers: { Authorization: process.env.SENDCOREX_TOKEN } },
);
const [result] = response.data.results;
if (result.type !== 'SUCCESS') throw new Error(`${result.code}: ${result.message}`);
console.log(result.data);レスポンス
{
"type": "SUCCESS",
"results": [
{
"command": "set_trust",
"id": "0",
"type": "SUCCESS",
"data": {
"from_email": "client@example.com",
"trust_status": "trusted",
"is_trusted": true
}
}
]
}レスポンスの項目
from_email更新した送信者。
trust_status新しいステータス。
is_trustedステータスが
trustedの場合のみtrue。itemsemailsの場合:アドレスごとに1件、およびok_countとfailed_count。
多くの送信者をまとめて信頼
1つのコマンドで最大100件のアドレス。
Request · Response
{
"commands": [
{
"command": "set_trust",
"args": {
"emails": [
"john@acme.com",
"ana@foo.io"
],
"value": "trusted"
}
}
]
}
{
"items": [
{
"id": "john@acme.com",
"ok": true,
"data": {
"from_email": "john@acme.com",
"trust_status": "trusted",
"is_trusted": true
}
},
{
"id": "ana@foo.io",
"ok": true,
"data": {
"from_email": "ana@foo.io",
"trust_status": "trusted",
"is_trusted": true
}
}
],
"ok_count": 2,
"failed_count": 0
}エラー
HTTPレベルのエラーはtype、code、messageを返します。CMDと表示されたエラーは、HTTP 200でコマンドの結果内に返ります。
- 401
TOKEN_EXPIREDaccess tokenの有効期限が切れました。Refresh Tokenを呼んでリクエストを繰り返してください。
- 401
INVALID_TOKENトークンの形式が不正、不明、または取り消されています。
- 429
RATE_LIMITED同じIP + メールボックスで毎秒15リクエストまたは同時15件を超えました。Retry-Afterの秒数だけ待ってください。
- CMD
INVALID_ARGS必須の引数がないか不正です。
- CMD
NOT_FOUNDこのトークンでは、そのメッセージ、スレッド、フォルダーは存在しません。
- CMD
INTERNALサーバーエラー。詳細はサーバーのログにのみ記録されます。