云中客

梦想有多大,就能走多远

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

SendGrid设置

  1. Sender作成-域名方式
  2. 配置成功之后
  3. API KEY取得

Postfix配置

  1. 安装
    sudo apt install postfix
  • 选择Internet Site格式
  • domain 配置,需要设置sendgrid认证的domain
  1. 配置/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
  1. 配置/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
  1. 再启动
sudo systemctl restart postfix

其他问题

  • no mechanism available 问题需要安装如下包
apt-get install libsasl2-modules

posted on 2022-07-20 02:34  走遍江湖  阅读(134)  评论(0编辑  收藏  举报