LoginSignup
2
2

More than 5 years have passed since last update.

コマンドラインでsendmailの動作確認

Last updated at Posted at 2018-01-07

sendmailの動作確認のメモ

コマンド

echo -e "From: <from@domain.com>\nTo: <to@google.com>\nSubject: title\n\nbody" | sendmail -t to@google.com

ログ

/var/log/maillog

maillogがない場合はrsyslogを再起動してみる。

systemctl restart rsyslog
Failed to restart rsyslog.service: Unit not found.

となる場合はrsyslogをインストールして起動する。

yum -y install rsyslog
systemctl start rsyslog

アプリからメールを送った際にmaillogに以下のような警告が出る場合は

Authentication-Warning: localhost.localdomain: nginx set sender to

信頼済ユーザとして/etc/mail/trusted-usersnginxを追記する

echo nginx >> /etc/mail/trusted-users

メモ

ゲストOS上のログでstat=Sentとなっており、送信成功しているが、メールが届かない場合はOP25Bの設定がされている可能性がある。

例)gmail

ホストOS(windows)またはゲストOSで

telnet smtp.gmail.com 25

接続できなければプロバイダによりOP25B設定がされているので587(Submissionポート)で接続する設定を行う必要がありそう。検索すると設定方法が出てきますが認証設定が必要なので少し手間がかかる。

2
2
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
2
2