備忘録

備忘録

PostfixでYahooメールにリレーする方法

Ⅰ. はじめに

タイトルの通り「PostfixでYahooメールにリレーする方法」です。

Ⅱ. 環境

$ cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)

Ⅲ. Postfix の設定

1. main.cf ファイルに以下を追記する
$ vim /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/password_maps
smtp_sasl_security_options = noanonymous
2. transport ファイルを編集する
$ vim /etc/postfix/transport
*       smtp:[smtp.mail.yahoo.co.jp]:587
3. password_maps ファイルを編集する
$ vim /etc/postfix/password_maps
[smtp.mail.yahoo.co.jp]:587     usre_name@yahoo.co.jp:password
4. データベースを再構築する
postmap hash:/etc/postfix/transport
postmap hash:/etc/postfix/password_maps
5. Postfix の設定をリロードする
$ service postfix restart

Ⅳ. telnet を利用してテストメールを送信する

$ telnet localhost smtp
# ctrl + ] を押す
telnet> toggle crlf

HELO localhost
MAIL FROM: user_name@yahoo.co.jp
RCPT TO: xxx@gmail.com
DATA
Subject: Hello!
This is a test mail.
.

QUIT