我已经浏览了我能找到的关于这个问题的每一点文档,但无法弄清楚。肯定有人将 Sendgrid 作为 SMTP 用于讨论博客,但我不知道怎么做。
这是我的 app.yml 设置:
env:
LANG: en_US.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
UNICORN_WORKERS: 3
DISCOURSE_DEVELOPER_EMAILS: 'admin@my_domain.com'
DISCOURSE_HOSTNAME: 'my_domain.com'
DISCOURSE_RELATIVE_URL_ROOT: /forum
## TODO: The mailserver this Discourse instance will use
DISCOURSE_SMTP_ADDRESS: smtp.sendgrid.net
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: apikey
DISCOURSE_SMTP_PASSWORD: API_KEY
DISCOURSE_SMTP_ENABLE_START_TLS: true
显然my_domain
和API_KEY
被替换为适当的值。我已经三次检查这些事情是否正确。我已经多次重建了应用程序launcher rebuild app
。
话语管理 UI 显示以下设置:
但是,当我尝试发送任何电子邮件时,我会收到一个弹出窗口,上面写着:
There was a problem sending the test email. Please double-check your mail settings, verify that your host is not blocking mail connections, and try again.
服务器上的实际日志不是很有帮助:
Sent mail to test@my_email.com (91.2ms)
Completed 422 Unprocessable Entity in 287ms (Views: 0.2ms | ActiveRecord: 0.4ms)
但是当我检查管理电子邮件 UI 的“跳过”选项卡时,我看到“跳过原因”是[Sender] 550 Unauthenticated senders not allowed
- 所以我认为这是 SendGrid 的身份验证问题。我该如何解决这个问题?