sendmailの転送(配送)先を指定する




ver 8.13.7

メールサーバで特定の宛先のメールを静的に特定のメールサーバに転送したい場合、
sendmailでは以下のように設定する

まずは、sendmail.mcを作成
以下の行を追加
FEATURE(`mailertable', `hash -T<TMPF> -o /etc/mail/mailertable')dnl

このsendmail.mcでsendmail.cfを作り直す

次に実際の転送(配送)先を記載するファイルを作成する

設定ファイル:/etc/mail/mailertable

mailertableの記載方法

aaa.bbb.ccc smtp:1.1.1.1 ・・・(1)
ddd.eee.fff smtp:2.2.2.2 ・・・(2)
.ddd.eee.fff smtp:2.2.2.2 ・・・(3)

(解説)
(1)aaa.bbb.ccc宛のメールは1.1.1.1に転送(配送)する
(2)ddd.eee.fff宛のメールは2.2.2.2に転送(配送)する
(3)*.ddd.eee.fff宛のメールは2.2.2.2に転送(配送)する

mailertableファイルを作成しただけでは動作に反映されない
次のコマンドを実施

# cd /etc/mail
# makemap hash mailertable < mailertable

最後にsendmailプロセスを再起動

/etc/init.d/sendmail stop
/etc/init.d/sendmail start