Sendmailのtrusted-usersの設定
「sendmail」を使用してPHPなどのプログラムからメール送信を行う時に、「-f」オプションを使用して「from」ヘッダにメールアドレスを指定すると、送信されたメールのヘッダに「X-Warning」が付加され、メールサーバによっては迷惑メールと間違われてしまうことがあります。
RapidSiteでは「sendmail」を使用しているので、良くこの問題が発生します。
この対策として、「/etc/mail/trusted-users」にWEBサーバの実行ユーザを追加すれば、「X-Warning」ヘッダは付加されなくなります。
1. WEBサーバの実行ユーザの調査
Apacheの設定ファイル「/etc/httpd/conf/httpd.conf」の「User」ディレクティブを見て、実行ユーザを調べます。
設定ファイルをオープンします。
# vi /etc/httpd/conf/httpd.conf
「User」ディレクティブの値を調べます。
# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group #-1 on these systems!
#
User apache
Group apache
ここでは、「apache」が実行ユーザとなります。
設定ファイルをクローズします。
2. Apache実行ユーザの追加設定
「/etc/mail/trusted-users」に1.で調べた実行ユーザを追加します。
# vi /etc/mail/trusted-users
【書き換え前】
# trusted-users - users that can send mail as others without a warning
# apache, mailman, majordomo, uucp, are good candidates
【書き換え後】
# trusted-users - users that can send mail as others without a warning
# apache, mailman, majordomo, uucp, are good candidates
apache
3. sendmailの再起動
設定の変更を反映させるために、「sendmail」を再起動します。
# /usr/local/sbin/restart_sendmail
※RapidSiteでは、専用のコマンドがあります。
もしくは、
# service sendmail restart
最終更新:2014年09月29日 13:38