logwatchのメールがgmailに届かなくなる

投稿者: | 2023年11月10日

ふと気づいたら、logwatchから送信しているメールがgmailに届かなくなっていました。メールのログを確認すると次のようになっています。(IPなどは伏字)

relay=gmail-smtp-in.l.google.com[74.125.204.26]:25, delay=8.8, delays=6/0.02/1.2/1.6, dsn=5.7.26, status=bounced (host gmail-smtp-in.l.google.com[74.125.204.26] said: 550-5.7.26 This mail has been blocked because the sender is unauthenticated. 550-5.7.26 Gmail requires all senders to authenticate with either SPF or DKIM. 550-5.7.26  550-5.7.26  Authentication results: 550-5.7.26  DKIM = did not pass 550-5.7.26  SPF [***] with ip: [***] = did not pass 550-5.7.26  550-5.7.26  To mitigate this issue, please visit Gmail's authentication guide 550-5.7.26 for instructions on setting up authentication: 550 5.7.26  https://support.google.com/mail/answer/81126#authentication 

SPFが未設定の場合などに発生するエラーのようですが、送信元メールアドレスのドメインのSPFは設定済みです。どうもその送信元のメールアドレスが正常に使われていないのではと考え、logwatch.confにつぎのように記述しました。

mailer = "/usr/sbin/sendmail -t -f (送信元メールアドレス)"

この設定にしたところ、正常に送信されるようになりました。