SendGrid设置
- Sender作成-域名方式
- 配置成功之后
- API KEY取得
Postfix配置
- 安装
sudo apt install postfix
- 选择Internet Site格式
- domain 配置,需要设置sendgrid认证的domain
- 配置/etc/postfix/main.cf
以下内容添加
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_security_level = encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
- 配置/etc/postfix/sasl_passwd(没有时新规作成)
[smtp.sendgrid.net]:587 apikey:yourSendGridApiKey
- 更新文件
# root以外无权限
sudo chmod 600 /etc/postfix/sasl_passwd
# postfix使用更新
sudo postmap /etc/postfix/sasl_passwd
- 再启动
sudo systemctl restart postfix
其他问题
- no mechanism available 问题需要安装如下包
apt-get install libsasl2-modules
每天成就一小步,积累下来就是一大步。
转发本文请注明出处,谢谢您的阅读与分享!