LoginSignup
1
0

More than 5 years have passed since last update.

Amazon linux からメールを送信する。

Posted at

Amazon Linux でメールを送信する。

amazon linux でメールを送信しようとしたところ、最初は送信できており安心していたのだが、
翌日送信しようとしたら全く送れなくなっていた。
構成としては
・AWS EC2
・VPC を Direct connect で社内と閉域網を組んでいる。

echo "test" | mail -s "test" xxxxxx@gmail.com

これでも送れていたのだが。。。。

原因はこのへんか?
https://dev.classmethod.jp/cloud/aws/ec2-send-email-best-practice/ 

tail -f /var/log/maillog
にてメールを見たところ、
554 Message rejected: Email address is not verified. The following identities failed the check in region US-EAST-1
とエラーが吐き出されている。

インターネットへの出口は社内の閉域網から一本だけでドメインのSPFレコードへの追加等も
ややこしいかもしれない。。。

とりあえず下記を参考にPOSTFIXにSESを設定
https://docs.aws.amazon.com/ja_jp/ses/latest/DeveloperGuide/postfix.html

複数のメールアドレスを認証済み状態にして
echo "test" | mail -s "test" xxxxxx@gmail.com -r yyyy@hogehoge.com
でメールを送信したところ送信完了。
yyyy@hogehoge.com は認証されたメール出ないとエラーになってしまった。

sudo postqueue -p
でメールキューを見ると大量に存在
sudo postsuper -d ALL
でたまってるメールをすべて削除して解決!!

ちなみに料金はこのくらいなので問題ないかなと。
https://aws.amazon.com/jp/ses/pricing/

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0