SES の Bounce, Complaint, Reject シミュレーション

SES の Bounce, Complaint, Reject シミュレーション

Takahiro Iwasa
(岩佐 孝浩)
Takahiro Iwasa (岩佐 孝浩)
2 min read
SES

SES ユーザーは、 Bounce, Complaint, Reject の割合を一定の閾値以下に保つ必要があります。適切にハンドリングできないと、最悪の場合には AWS からペナルティを受ける可能性があります。これらのシミュレーションは、対応方法を検討する際に役立ちます。

前提条件

SES にメールアドレスが既に登録されており、 Email Feedback Forwarding がオンになっていることを確認してください。

Bounce のシミュレーション

以下のコマンドを実行して、 Bounce をシミュレートできます。

aws ses send-email --from <YOUR_EMAIL> --to [email protected] --subject test --text test

--from オプションで指定されたアドレスから、次のようなメールを受信するはずです。

Complaint のシミュレーション

以下のコマンドを実行して、 Complaint をシミュレートできます。

aws ses send-email --from <YOUR_EMAIL> --to [email protected] --subject test --text test

--from オプションで指定されたアドレスから、次のようなメールを受信するはずです。

You should receive the following email sent from the address specified by --from option.

Reject のシミュレーション

EICAR テストファイルを添付してメールを送信するには、以下のコマンドを実行してください。

FROM=<YOUR_EMAIL>
MESSAGE='{"Data": "From: $FROM\nTo: $FROM\nSubject: test\nMIME-Version: 1.0\nContent-type: Multipart/Mixed; boundary=\"NextPart\"\n\n--NextPart\nContent-Type: text/plain\n\ntest\n\n--NextPart\nContent-Type: text/plain;\nContent-Disposition: attachment; filename=\"sample.txt\"\n\nX5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*\n\n--NextPart--"}'
MESSAGE=$(echo $MESSAGE | sed "s/\$FROM/$FROM/g")
aws ses send-raw-email --cli-binary-format raw-in-base64-out --raw-message "$MESSAGE"

FROM で指定されたアドレスから、次のようなメールを受信するはずです。

Takahiro Iwasa
(岩佐 孝浩)

Takahiro Iwasa (岩佐 孝浩)

Software Developer at iret, Inc.
主に AWS を利用したクラウドネイティブアプリケーションの設計および開発をしています。 Japan AWS Top Engineers 2020-2023