「Outbound Port 25 Blocking」(以下、OP25B)の対策を行います。
使用している「ISP」が「OP25B」を導入している場合、自宅サーバにも設定が必要になってきます。もし、「ISP」が「OP25B」を導入しているにもかかわらず自宅サーバの設定を行わない場合はメールが送信できません。
最近の大手ISPは大体「OP25B」を導入していると思われます。
(1)「ISP」の「SMTP認証タイプ」を調べる。
[root@mail1 ~]# telnet プロバイダのSMTPサーバ 587 Trying xxx.xxx.xx.xx... Connected to xxxxxxxxxxx (xxx.xxx.xx.xx). Escape character is '^]'. 220 xxxxxxxxx ESMTP ehlo localhost ← # 認証タイプを調査 250-ENHANCEDSTATUSCODES 250-PIPELINING 250-8BITMIME 250-SIZE 10240000 250-DSN 250-AUTH LOGIN PLAIN ← # 認証タイプ 250-STARTTLS 250-DELIVERBY 250 HELP
(2)「Postfix」で「OP25B」対策を行う。
[root@mail1 ~]# vi /etc/postfix/main.cf # INTERNET OR INTRANET # The relayhost parameter specifies the default host to send mail to # when no entry is matched in the optional transport(5) table. When # no relayhost is given, mail is routed directly to the destination. # # On an intranet, specify the organizational domain name. If your # internal DNS uses no MX records, specify the name of the intranet # gateway host instead. # # In the case of SMTP, specify a domain, host, host:port, [host]:port, # [address] or [address]:port; the form [host] turns off MX lookups. # # If you're connected via UUCP, see also the default_transport parameter. # #relayhost = $mydomain #relayhost = [gateway.my.domain] #relayhost = [mailserver.isp.tld] #relayhost = uucphost #relayhost = [an.ip.add.ress] relayhost = [プロバイダのSMTPサーバ名]:587 ← # プロバイダのSMTPサーバ、サブミッションポートを指定 ----------最終行に追加--------- smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/authinfo smtp_sasl_security_options = noanonymous smtp_sasl_mechanism_filter = PLAIN
(3)「Postfix」の「OP25B」設定で使用するファイルを作成する。
[root@mail1 ~]# echo [SMTPサーバ名]:ユーザ名:パスワード > /etc/postfix/authinfo [root@mail1 ~]# chmod 640 /etc/postfix/authinfo [root@mail1 ~]# postmap /etc/postfix/authinfo
(4)「Postfix」の再起動を行う。
[root@mail1 ~]# /etc/rc.d/init.d/postfix restart postfix を停止中: [ OK ] postfix を起動中: [ OK ]