Archive for 2010/3/16

Postfixで送信をGmail経由にする

これは Postfixの送信をすべて Gmail経由にする手順
From: が Gmailの登録アドレス(複数登録できるけど、使うものすべて登録しておくのは現実的じゃないよね)になるので、マルチドメインを管理しているサーバの Postfixを置きかえるのは現実的じゃないけど、一応やってみたので。
 

# apt-get install sasl2-bin 

# e /etc/postfix/main.cf
relayhost = [smtp.gmail.com]:587
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
smtp_use_tls=yes
smtp_tls_CAfile = /etc/postfix/thawte_Primary_Root_CA.pem
smtp_tls_loglevel = 0
smtp_tls_security_level = secure

 

# e /etc/postfix/sasl_password
[smtp.gmail.com]:587    user@gmail.com:password

# postmap /etc/postfix/sasl_password

 
TLS 証明書をダウンロードする。
Gmailの場合はこちら ⇒ https://www.thawte.com/roots/index.html
名前や電話番号などを入れて Acceptを押すとダウンロードできる。解凍したら、いろいろあるうちの『Thawte Roots/Thawte SSLWeb Server Roots/thawte Premium Server CA/Thawte Premium Server CA.pem』を入れる。(上では、ファイル名にスペースが入っているのが気持ち悪くて_にリネームしたけど)
 
参考:
Gmailをリレーしてメール送信する設定
Postfix で、Gmail にメールをリレーする
Ubuntu 9.04 Server – Postfixの設定

Postfixでdocomoだけ別サーバ経由にする

# e /etc/postfix/main.cf
transport_maps = hash:/etc/postfix/transport
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/saslpass
smtp_sasl_security_options =

 

# e /etc/postfix/transport
docomo.ne.jp  :[hogehoge.com]:587
.docomo.ne.jp :[hogehoge.com]:587

# postmap /etc/postfix/transport

 

# e /etc/postfix/saslpass
hogehoge.com user@hogehoge.com:password

# postmap /etc/postfix/saslpass

 
postfixを restartでOK
 
MacOSX(Postfix)でSMTP Authクライアントをやってみる。その2 が一番わかりやすかった。

格安プロバイダ

DIX
月額 980円で固定IPが1つタダ
インターリンク(月額2100円)より安い

インターリンク:自分ドメイン+Gmailの使い方

【ドメイン名】    : hogehoge.com
【コントロールパネル】: https://www.google.com/a/hogehoge.com
 
EdMaxの設定
 SMTP: smtp.gmail.com
 POP3: pop.gmail.com / user@hogehoge.com / password
 SMTPサーバ種別: SMTPS
 受信サーバ種別:  POP3S
 SMTPポート:   465
 POP3ポート:   995
 SMTPは認証が必要
 
SMTPS、POP3Sにするところがキモ!