简体   繁体   English

AWS SES 的 Discourse 电子邮件配置

[英]Discourse email configuration for AWS SES

I'm trying to get Discourse set up on an AWS EC2 instance, but am having problems getting the emails to send via AWS SES.我正在尝试在 AWS EC2 实例上设置 Discourse,但在通过 AWS SES 发送电子邮件时遇到问题。

Firstly I have an email and a domain set up and confirmed (not in sandbox mode) on AWS SES and I can successfully send test emails from the AWS SES dashboard, and also manually through postfix running on the Discourse machine instance.首先,我在 AWS SES 上设置并确认了电子邮件和域(不是在沙盒模式下),我可以从 AWS SES 仪表板成功发送测试电子邮件,也可以通过在 Discourse 机器实例上运行的 postfix 手动发送。

I have attempted to follow instructions here: http://stroupaloop.com/blog/discourse-setup-using-aws/ (though realise this is quite old now, so perhaps the config is different now) and also found Discourse SES AWS working app.yml file example please - but this config isn't working for me either.我试图按照此处的说明进行操作:http: //stroupaloop.com/blog/discourse-setup-using-aws/ (尽管现在意识到这已经很老了,所以现在的配置可能有所不同)并且还发现Discourse SES AWS 正在运行请使用 app.yml 文件示例- 但此配置也不适合我。

For info, I'm editing the app.yml file by doing....有关信息,我正在通过执行...来编辑 app.yml 文件。

$ sudo ./launcher stop app
$ sudo nano ./containers/app.yml

[making the edits and saving] [进行编辑和保存]

$ sudo ./launcher bootstrap app

[it tells me it has bootstrapped correctly] [它告诉我它已经正确引导]

$ sudo ./launcher start app

[I can now view the discourse site, but can;t login to any accounts as the confirmation emails aren't getting sent] [我现在可以查看讨论站点,但无法登录任何帐户,因为没有发送确认电子邮件]

Currently I have this in my app.yml file (sensitive info replaced):目前我的 app.yml 文件中有这个(敏感信息被替换):

  DISCOURSE_SMTP_ADDRESS: email-smtp.eu-west-1.amazonaws.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: XXXXXXXXXXXXXXXX
  DISCOURSE_SMTP_PASSWORD: XXXXXXXXXXXXXXXXXXXX
  DISCOURSE_SMTP_ENABLE_START_TLS: true           
  DISCOURSE_SMTP_AUTHENTICATION: "login"
  DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
  DISCOURSE_SMTP_DOMAIN: mydomain.net
  DISCOURSE_SMTP_FROM_ADDRESS: me@mydomain.net

Also, in the SES sending stats dashboard, I'm not even seeing that it's trying to send the email.此外,在 SES 发送统计仪表板中,我什至没有看到它正在尝试发送电子邮件。

So even a good starting point would be to know if there is an email log file somewhere in the Discourse docker container that I can look at to see what the issue may be.因此,即使是一个好的起点,也可以知道 Discourse docker 容器中某处是否有电子邮件日志文件,我可以查看该文件以了解可能是什么问题。

Any help on where I'm going wrong here would be much appreciated.任何关于我在这里出错的地方的帮助将不胜感激。

I had a similar issue and I fixed it by editing app.yml and adding this line towards the end (the line is commented out by default):我有一个类似的问题,我通过编辑app.yml并将这一行添加到末尾来修复它(默认情况下该行被注释掉):

- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"

You must replace info@unconfigured.discourse.org with the validated email address associated with your SES credentials.您必须将info@unconfigured.discourse.org替换为与您的 SES 凭证关联的经过验证的电子邮件地址。 You can check your validated email address identities under AWS -> SES -> Identity Management -> Email Addresses, the Verification Status must be verified.您可以在 AWS -> SES -> Identity Management -> Email Addresses 下检查您已验证的电子邮件地址身份,必须验证验证状态。 If you managed to send and receive a test email from here, you probably have this already set up.如果您设法从这里发送和接收测试电子邮件,您可能已经设置好了。

Once you have applied these changes, re-run the setup script to pick up the changes:应用这些更改后,重新运行安装脚本以获取更改:

sudo ./discourse-setup

Hope this works at your end!希望这对你有用!

I had my discourse deployed in ec2 using bitnami and after trying for hours I was able to configure SES sandbox with discourse heres what I did我使用 bitnami 在 ec2 中部署了我的话语,在尝试了几个小时后,我能够使用话语配置 SES 沙箱,这就是我所做的

  1. created SMTP credentials in the aws console在 aws 控制台中创建 SMTP 凭据
  2. I verified two emails in aws console, since the email service was in sandbox so both sender and receiver emails have to be verified我在 aws 控制台中验证了两封电子邮件,因为电子邮件服务在沙箱中,因此必须验证发件人和收件人的电子邮件
  3. I added smtp settings to this file /apps/discourse/htdocs/config/discourse.conf which looked like this我将 smtp 设置添加到这个文件/apps/discourse/htdocs/config/discourse.conf看起来像这样
db_name = bitnami_discourse
db_host = /opt/bitnami/postgresql
db_port = 5432
db_pool = 25
hostname = 3.89.1xx.xx
db_username = bn_discourse
db_password = “xxxxxxxxxx”
redis_port = 6379
redis_path = /opt/bitnami/redis/var/run/redis.sock

smtp_address =“email-smtp.us-east-1.amazonaws.com”
smtp_port = 587
smptp_security = ssl
smtp_domain = 3.89.1xx.xx
smtp_user_name = ‘xxxxxxxxxxxxxxxxx’
smtp_password = ‘xxxxxxxxxxxxxxxxxxxxxxxxxxxx’
from_address = youremailaddress@example.com

The smptp username and password are the same SMTP credentials you obtain in step 1 after you configured this file make sure to restart the server by running this command outside of /apps smptp 用户名和密码与您在配置此文件后在步骤 1 中获得的 SMTP 凭据相同确保通过在 /apps 之外运行此命令来重新启动服务器

sudo /opt/bitnami/ctlscript.sh restart

heres a reference这是一个参考

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM