特定のホストにメールをルーティングするように sendmail を設定する方法
Environment
- Red Hat Enterprise Linux 5
- Red Hat Enterprise Linux 6
- Red Hat Enterprise Linux 7
- Red Hat Enterprise Linux 8
- Red Hat Enterprise Linux 9
- Sendmail
Issue
- 特定のホストにメールをルーティングするように sendmail を設定するには、どうすればよいですか?
Resolution
これは、"/etc/mail/mailertable" ファイルに適切なエントリーを追加することで実現できます。このファイルを使用すると、ドメインと、そのドメイン宛てのすべてのメールの送信先となる MTA を指定できます。以下の例では、"mydomain.com" 宛てのすべてのメールは、"backend.mail.server" に解決されるメールサーバーに自動的に転送されます。
例:
# cat /etc/mail/mailertable
mydomain.com smtp:backend.mail.server
extdomain.com smtp:[192.x.cc.x:port]
test.jp esmtp:[1.2.3.4] ## test.jp will be forwarded directly to the SMTP server at IP address 1.2.3.4.
.test.jp esmtp:[1.2.3.4] ## any subdomain under test.jp (e.g. bbb.test.jp) will be forwarded to 1.2.3.4.
aaa.test.jp esmtp ## Emails addressed to aaa.test.jp will be routed using DNS MX records.
.aaa.test.jp esmtp ## Emails addressed to *.aaa.test.jp will be routed using DNS MX records.
- 以下のコマンドを実行して、mailertable データベースを再構築します。
# makemap hash /etc/mail/mailertable.db < /etc/mail/mailertable
- その後、sendmail を再起動します。
# service sendmail restart
Root Cause
Diagnostic Steps
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Comments