【问题标题】:How to get /usr/bin/mail to send mail via gmail on Mac 10.14?如何让 /usr/bin/mail 在 Mac 10.14 上通过 gmail 发送邮件?
【发布时间】:2019-07-18 02:30:17
【问题描述】:

我试图让 /usr/bin/mail 从运行 OS X 10.12 的 Mac 服务器上的命令行工作,以实现一个 php 例程,该例程将来自外部 CRM 站点的 http 请求路由到另一个站点通过电子邮件提供短信。我调查了几个来源,并将我的 gmail 凭据添加到 /etc/postfix/smtp_sasl_passwords、smtp_tls_sites、使用 /etc/postfix/main.cf、重新加载 postfix 等。我已经测试过我可以使用我存储在 smtp_sasl_passwords 文件中的凭据,可以从那里发送和接收邮件。我不断收到诊断代码:smtp; 530-5.5.1 需要身份验证。

我已阅读然后建议的页面,但似乎我正在提供所有这些信息。我将不胜感激有关如何确定哪些身份验证丢失或错误的建议。

【问题讨论】:

    标签: macos email gmail sendmail


    【解决方案1】:

    我发现我使用的电子邮件服务器 google 已更改为使用双因素身份验证,这要求我获取一个特殊的“密码”,以便在通过 postfix 邮件进行通信时使用。一旦我得到它并用这个特殊的密码替换了我的正常密码,一切都开始工作了。这是在 #relayhost = $mydomain

    之后在 /etc/postfix/main.cf 中起作用的内容
    relayhost = [smtp.gmail.com]:587
    smtp_sasl_auth_enable = yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    smtp_sasl_security_options = noanonymous
    smtp_use_tls = yes
    # Separate recommendation from stackoverflow.com/questions/26447316/
    smtp_sasl_mechanism_filter = plain
    

    并且,您必须提供一个文件“sasl_passwd”,其中包含

    [smtp.gmail.com]:587 userid@gmail.com:special_password 他们提供

    然后运行:

    sudo postmap /etc/postfix/sasl_passwd
    sudo postfix reload
    

    这似乎为我解决了问题。希望他们能帮助别人。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-12
      • 2011-05-11
      • 1970-01-01
      • 2016-08-31
      • 1970-01-01
      • 2016-08-29
      相关资源
      最近更新 更多