差異處
這裏顯示兩個版本的差異處。
下次修改 | 前次修改 | ||
tech:postfix [2019/12/10 13:59] – 建立 jonathan_tsai | tech:postfix [2021/01/16 14:40] (目前版本) – 更換 plugin jonathan | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== CentOS7 安裝 postfix 透過 gmail 寄信 ====== | ||
+ | |||
+ | 因為很多系統訊息需要透過 Mail 寄出, 目前透過 GMail 寄出信件是最容易不被當成垃圾信件 | ||
+ | |||
+ | * 安裝環境: | ||
+ | |||
+ | ===== 安裝相關套件 ===== | ||
+ | * <code sh> | ||
+ | yum install postfix cyrus-sasl{, | ||
+ | </ | ||
+ | |||
+ | ===== 編輯相關設定檔 ===== | ||
+ | * 編輯 / | ||
+ | : | ||
+ | #relayhost = [an.ip.add.ress] | ||
+ | relayhost = [smtp.gmail.com]: | ||
+ | |||
+ | smtp_use_tls=yes | ||
+ | # use sasl when authenticating to foreign SMTP servers | ||
+ | smtp_sasl_auth_enable = yes | ||
+ | # path to password map file | ||
+ | smtp_sasl_password_maps = hash:/ | ||
+ | # list of CAs to trust when verifying server certificate | ||
+ | smtp_tls_CAfile = / | ||
+ | # eliminates default security options which are imcompatible with gmail | ||
+ | smtp_sasl_security_options = noanonymous | ||
+ | smtp_always_send_ehlo = yes | ||
+ | |||
+ | |||
+ | # REJECTING UNKNOWN RELAY USERS | ||
+ | : | ||
+ | </ | ||
+ | * 編輯 / | ||
+ | [smtp.gmail.com]: | ||
+ | </ | ||
+ | <note warning> | ||
+ | * 如果 Google 的帳號有設定二階段認證, | ||
+ | * 參考 - https:// | ||
+ | </ | ||
+ | * 產生 sasl_passwd.db <code sh> | ||
+ | postmap / | ||
+ | </ | ||
+ | * 讓 postfix 新設定生效 <code sh> | ||
+ | systemctl start postfix | ||
+ | systemctl enable postfix | ||
+ | </ | ||
+ | * 透過 / | ||
+ | : | ||
+ | Dec 10 13:43:39 ct-wiki postfix/ | ||
+ | Dec 10 13:43:39 ct-wiki postfix/ | ||
+ | Dec 10 13:43:39 ct-wiki postfix/ | ||
+ | Dec 10 13:43:41 ct-wiki postfix/ | ||
+ | Dec 10 13:43:41 ct-wiki postfix/ | ||
+ | Dec 10 13:45:23 ct-wiki postfix/ | ||
+ | Dec 10 13:45:24 ct-wiki postfix/ | ||
+ | Dec 10 13:45:24 ct-wiki postfix/ | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== 參考網址 ===== | ||
+ | * [[https:// | ||
+ | * https:// | ||
+ | |||
+ | {{tag> | ||