Powered by
Movable Type 4.1

« sendmail.mcからsendmail.cfを作成するには | メインですよ(エントリーアーカイブ) | 基本コマンド »

メールのルーティング

メールルーティング用メールサーバーのSendmailの設定。

■あるドメイン宛のメールは全部、担当ホストにリレーしてしまう。(mailertable)
例:xxx@hogehoge.local宛のメールはすべてhogemail.hogehoge.localに中継する。

○/etc/mail/sendmail.mc

FEATURE(`mailertable',`hash -o /etc/mail/mailertable.db')dnl

○/etc/mail/mailertable

sapporo.hogehoge.local	smtp:mail.sapporo.hogehoge.local


■ドメインにとどまらず、メールアドレスによって振る舞いを決める(virtusertable)

○/etc/mail/sendmail.mc

FEATURE(`virtusertable',`hash -o /etc/mail/virtusertable.db')dnl

○/etc/mail/virtusertable

# postmaster, admin宛てのメールは
# メールゲートウェイサーバーのrootが受け取るようにしている。

postmaster@hogehoge.local root
admin@hogehoge.local root

# imap.hogehoge.local 公用のアドレスはimapサーバーに届かせる。
info@hogehoge.local hoge-staff@imap.hogehoge.local
sales@hogehoge.local sales@imap.hogehoge.local
recruit@hogehoge.local recruit@imap.hogehoge.local

# 上から順番にマッピングしていき、
# 最後の行の@の前の部分は、すべて%1に代入される。
# 一般ユーザー用のメールはpopサーバーに配送されるイメージ。

@hogehoge.local %1@pop.hogehoge.local


# support.hogehoge.localというサブドメイン用のマッピングも
# 同じくvirtusertableに記述できる。

postmaster@support.hogehoge.local root
user01@support.hogehoge.local user01@imap.hogehoge.local
user02@support.hogehoge.local user02@imap.hogehoge.local

# 「そんなユーザーは存在しない」というえらーメッセージを返信するなら
# error:~~と書けばよい。「~~」の部分がえらーメールのbodyとなる。

@support.hogehoge.local error:nouser No such user here


# もちろん違うドメインのメールをリレーすることも可能である。
postmaster@example.local root
@example.local %1@example.hogehoge.local

コメントを投稿

(いままで、ここでコメントしたことがないときは、コメントを表示する前にこのブログのオーナーの承認が必要になることがあります。承認されるまではコメントは表示されません。そのときはしばらく待ってください。)