【发布时间】:2013-05-03 16:04:42
【问题描述】:
我正在尝试编写一个 bash 脚本,由一个 cron 任务运行,它会在某些情况下向我发送一封电子邮件。
为了尝试让 sendmail 与我的 Sendgrid SMTP 设置一起使用,我编辑了 /etc/postfix/main.cf 文件,其中包含以下内容:
smtp_sasl_password_maps = static:<username>:<password>
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
smtp_tls_security_level=encrypt
header_size_limit = 4096000
relayhost = [smtp.sendgrid.net]:587
我使用 sudo /etc/init.d/postfix restart
重新启动了 postfix并尝试使用以下命令从命令行发送电子邮件:
发送邮件 my@email.com/email.txt
这会产生以下输出:
您在 /var/mail/ubuntu 中有新邮件
为什么 sendgrid 不使用我在 main.cf 中指定的 Sendgrid SMTP 详细信息与我的电子邮件一起发送?
请注意,这个问题仅与 sendmail 有关,我不想安装其他 SMTP 客户端和应用程序,它需要按原样工作。
【问题讨论】: