在台灣使用sendmail寄信到外部郵件信箱(如gmail, pchome, hinet...), 大概都會遇到smtp需要認證的問題(SMTP AUTH). 為了解決這個問題, 必需要把sendmail的SMART_HOST, confAUTH及MASQUERADE功能打開.
1. 首先, 修改/etc/mail/sendmail.mc
修改SMART_HOST將你的外寄的smtp server加在裡面.
你的smtp server的密碼會設定在/etc/mail/authinfo.db
hibox會檢查寄件者的email address是不是是從公司email發的, 因此如果沒有emable MASQUERAD_AS選項, 寄件者的email就是yourname@localhost.localdomain. 所以如果你目前的email是yourname@aaa.bbb.com, 那就設成MASQUERAD_AS(`aaa.bbb.com’).
dnl # dnl # Uncomment and edit the following line if your outgoing mail needs to dnl # be sent out through an external mail server: dnl # dnl define(`SMART_HOST', `smtp.your.provider')dnl define(`SMART_HOST', `www.hibox.hinet.net')dnl define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl define(`confAUTH_OPTIONS', `A p y')dnl TRUST_AUTH_MECH(`LOGIN PLAIN')dnl FEATURE(`authinfo',`hash /etc/mail/authinfo.db')dnl dnl # dnl # The following example makes mail from this host and any additional dnl # specified domains appear to be sent from mydomain.com dnl # dnl MASQUERADE_AS(`mydomain.com')dnl MASQUERADE_AS(`yourcompany.com')dnl dnl # dnl # masquerade not just the headers, but the envelope as well dnl # FEATURE(masquerade_envelope)dnl dnl # dnl # masquerade not just @mydomainalias.com, but @*.mydomainalias.com as well dnl # FEATURE(masquerade_entire_domain)dnl dnl FEATURE(`local_no_masquerade')dnl dnl # MASQUERADE_DOMAIN(localhost)dnl MASQUERADE_DOMAIN(localhost.localdomain)dnl |
2. 執行下面指令產生sendmail的設定檔
3. 編輯/etc/mail/authinfo, 加入帳號密碼:
AuthInfo:www.hibox.hinet.net "U:yourname" "I:yourname@yourcompany.com" "P:yourpassword" "M:LOGIN PLAIN" |
4. 執行下面指令產生sendmail的密碼檔
# makemap hash /etc/mail/authinfo < /etc/mail/authinfo
5. 重新起動sendmail
# /etc/init.d/sendmail restart
6. 測試
# sendmail yourname@yourcompany.com
參考自: http://www.screaming-penguin.com/node/4214
沒有留言:
張貼留言