Biglobeで接続した自宅サーバからsmtpメール送信

mysza 自宅サーバからの送信メールが、正常に配信されていない。
現象を調べたところ、プロバイダーのスパムメール対策(OP25B)によりブロックされていた。

Biglobeの動的IPサービス利用者が自宅サーバからメール送信する場合は、専用のSMTPサーバを経由する必要があり、且つこのサーバでは、SMTP認証が要るという事なので、その設定を行った。

Biglobeでは、送信用SMTPサーバは、こちらのページから利用申請して、指定を受ける。
利用申請には、Biglobe接続用のユーザID/パスワードが、SMTP認証には、Biglobeのメールアドレスとそのパスワードが要る。

設定方法については、以下のページを参考にした。

PostfixをSMTPクライアントとしてSASL認証

緑の部分は、それぞれの環境や、Biglobeから与えられた情報に応じ設定するものとする。
まずは、Postfixを導入して、Sendmailから、切り替える。

# yum -y install postfix system-switch-mail
# /usr/sbin/system-switch-mail
# rpm -e system-switch-mail
# rpm -e sendmail

 
次に、/etc/postfix/main.cfの設定変更

myhostname = YourServer.YourDomain
mydomain = YourDomain
myorigin = $mydomain
inet_interfaces = localhost #デフォルト
mydestination = $myhostname, localhost.$mydomain, localhost #デフォルト
mynetworks = 127.0.0.0/8
smtpd_banner = $myhostname ESMTP $mail_name  #有効化

Postfixを再起動

# service postfix restart

/etc/aliasesの設定

root:  MyAddress@MyDomain    #root宛メールの転送先アドレス

/etc/aliasesの変更内容を有効化

# newaliases

/etc/postfix/main.cf で、中継サーバの設定

# /etc/postfix/main.cf

relayhost = [smtpServer.biglobe.ne.jp]:25

smtp_sasl_type = cyrus
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =

SMTP認証情報を設定

# vi /etc/postfix/sasl_passwd
[smtpauth.biglobe.ne.jp]:25 mail@xxx.biglobe.ne.jp:mailpasswd

/etc/postfix/sasl_passwdのパーミション変更

# chmod 600 /etc/postfix/sasl_passwd

認証情報DB化及びReload

# postmap /etc/postfix/sasl_passwd
# /etc/init.d/postfix reload

これで、mailコマンドで、外部メールアカウントへのメール送信が可能になった。

Leave a Reply

You must be logged in to post a comment.