1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

MTA転送設定してるホストのfromアドレスの調整

Last updated at Posted at 2014-03-03

なんかソフトバンクのMTAからドメインが無いとかで蹴られてたので修正した記録です

xxx-admin01にpostfixが入っててrelayhostにxxx-mail01を指定しててxxx-mail01側にはqmailが入ってる感じです。
xxx-admin01からsoftbankあてにメールして届かず以下のようなログがxxx-mail01に出ていました。

送信失敗したsoftbank宛てメールに関するログ:

# grep 35579 /var/log/maillog
Mar  3 10:33:46 xxx-mail01 qmail: 1393810426.138145 starting delivery 35579: msg 153145 to remote xxxxxxxx_k@i.softbank.jp
Mar  3 10:33:46 xxx-mail01 qmail: 1393810426.214778 delivery 35579: failure: Connected_to_117.46.11.72_but_sender_was_rejected./Remote_host_said:_553_xxx-admin01.xxxxxxxx.com_does_not_exist/

みたかんじxxx-admin01.xxxxxxxx.comがMX登録されていないのでリジェクトされた風です。
たしかにMX登録されてるドメインはxxxxxxxx.comとかstaging.xxxxxxxx.comだけなので
fromのドメイン修正が必要なもよう。

参考:
http://d.hatena.ne.jp/think-t/20120930/p1
あとメール職人の先輩からのmyoriginのデフォルトはmyhostという情報

設定ファイルの修正を以下のように行いました。

# diff main.cf{,.`date +%Y%m%d`}
77,78d76
< #myhostname = xxx-admin01.xxxxxxxx.com
< #myhostname = xxxxxxxx.com
85c83
< mydomain = xxxxxxxx.com
---
> mydomain = xxx-admin01.xxxxxxxx.com
101c99
< myorigin = $mydomain
---
> #myorigin = $mydomain
167,168c165,166
< #mydestination = $myhostname, localhost.$mydomain, localhost
< mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
---
> mydestination = $myhostname, localhost.$mydomain, localhost
> #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

設定はこのほかに以下のような感じ。(ローカル内のMTAに転送するだけのクライアント的な)

inet_interfaces = localhost
inet_protocols = ipv4
relayhost = [xxx.xx.10.22]

設定をリロード

# service postfix reload
postfix を再読み込み中:                                    [  OK  ]

送ってみる

# printf "test2\ntest"|mail -s "testmail_`date +%Y%m%d.%H:%M`" xxxxxxxx_k@i.softbank.jp

このあとめでたくメール受信できました。

myorigin = $mydomain
として、
mydestination$mydomainを含める
といいようでした。

myorigin変えただけだと、(mail for mydomain loops back to myself)というログが出て、
転送先MTAに到達すらしないようでした。

設定されている値は
postconf|grep myorigin
という感じで確認できます

sendmailだとfromの調整は/etc/mail/submit.cfDjのところにドメイン指定するだけです。
もしMTA切替たい場合、CentOS6だとalternatives --config mtaで切り替えるかシンボリックリンク修正するか。
今回はいまさら何台も入れなおすのもアレだったので修正してみました。

以上です。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?