Sendgrid 免費帳號第一個月可以有40,000 免費的email 額度, 之後每天只能寄送100個信件
對於規模較小的網站其實就很夠用了
Sendgrid 不需要信用卡認證
Sendgrid 不需要驗證 Domain, 對於新手而言流程簡單許多
Sendgrid 登入後只要設定 SMTP API 即可, 然後修改 /etc/postfix/main.cf
之後重啟 postfix 即可測試驗證 Sendgrid 轉發 Email
需要yum安裝的 postfix 套件
1 2 |
yum install postfix cyrus-sasl-plain cyrus-sasl-md5 -y yum install mail |
修改/etc/postfix/main.cf 的內容
在main.cf最底下新增內容
1 2 3 4 5 |
mydestination = localhost.localdomain, localhost relayhost = [smtp.sendgrid.net]:25 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = static:apikey:你的 API 密碼 smtp_sasl_security_options = noanonymous |
重啟 postfix
1 |
/etc/init.d/postfix restart |
測試上面的配置,寄一封信給自己
1 |
echo 'Test passed.' | mail -s Test-Email EMAIL@EXAMPLE.COM |
從mail log 確認信件是否寄出
1 |
tail -n 5 /var/log/maillog |