# GmailのSMTPサーバを指定 relayhost = [smtp.gmail.com]:587 # TLSにより暗号化 smtp_use_tls = yes # plain方式の SMTP AUTH認証を有効にする smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_tls_security_options = noanonymous smtp_sasl_mechanism_filter = plain # GmailのTLS証明書の妥当性確認のための設定 smtp_tls_CApath = /etc/pki/tls/certs/ca-bundle.crt
- /etc/postfix/sasl_passwdを作成
[smtp.gmail.com]:587 username@gmail.com:password
- /etc/postfix/sasl_passwdの権限変更
# chown root:root /etc/postfix/sasl_passwd # chmod 600 /etc/postfix/sasl_passwd
- hash形式の /etc/postfix/sasl_passwd.dbを作成
# postmap /etc/postfix/sasl_passwd
- postfixの再起動
# /etc/init.d/postfix restart
- Gmail SMTP サーバーの証明書を正しく検証する
Gmail SMTP サーバーが持っている証明書から、ルート CA を調べる。
上記の openssl s_client セッションから、Thawte Premium Server CA がルート CA だと分かる。
ルート CA のインターネットドメイン thawte.com のルート証明書をダウンロード。
http://www.thawte.com/roots/ からダウンロード
/usr/share/ca-certificates/thawte.com/ 内に展開。
/etc/postfix/main.cf を編集
/usr/share/ca-certificates/thawte.com/Thawte SSLWeb Server Roots/thawte Premium Server CA/Thawte Premium Server CA.pem
- 注意点
From が自分のGmailアカウントで上書きされる。
送信メールが"送信済みメール"フォルダに配置される。
- Reference
linux.matchy.net - 2008-07-24 - Postfix から Gmail 経由でメールを送る
http://linux.matchy.net/archives/35
Postfix で、Gmail にメールをリレーする - 私の二次記憶
http://d.hatena.ne.jp/ayokoyama/20061207/p1