Moving from Mailgun to Amazon SES as an amateur

AI-generated summary

Jonathan5 shares their experience migrating from Mailgun to Amazon SES for email handling in Discourse. Though they didn’t document every step, they confirm the setup appears successful and are open to answering questions. Key steps included: creating a new SES identity for their domain and adding required DNS records (DMARC, etc.); generating SES SMTP credentials via AWS docs; updating app.yml with SES SMTP settings (address, port 587, username/password, and enabling STARTTLS). They referenced Discourse’s SMTP troubleshooting guide and added quotes around strings for safety. They also followed Discourse’s VERP setup guide to handle bounces/complaints via SNS: creating an SNS topic, subscribing it to https://your.discourse/webhooks/aws, and linking it to SES feedback notifications (without enabling raw message delivery). They avoided a full rebuild by using ./launcher destroy app && ./launcher start app after SMTP changes. Testing included: previewing emails via Admin > Email > Preview summary; validating deliverability via mail-tester.com (scoring 10/10); checking email logs in Admin > Email > Email logs (noting a previously reported error no longer occurs); and confirming notifications and reply-by-email functionality worked as expected. The process was largely smooth, with clear AWS and Discourse documentation guiding the transition.

I didn’t take notes for every single step of the way, but it seems to have worked. I’m happy to answer questions though can’t guarantee the answers will be good :slight_smile:

Created a new Amazon SES identity for forum.example.com. It tells you the records to add for DMARC etc.

This explains how to get SES SMTP credentials: Obtaining Amazon SES SMTP credentials - Amazon Simple Email Service

Changed SMTP settings in app.yml - see Troubleshoot email on a new Discourse install. I’m not sure about these files so I added double quotation marks around all the strings.

For Mailgun I was using port 2525 had commented out DISCOURSE_SMTP_ENABLE_START_TLS: true.

For SES:

  DISCOURSE_SMTP_ADDRESS: "email-smtp.eu-west-2.amazonaws.com"
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: "xxx"
  DISCOURSE_SMTP_PASSWORD: "xxx"
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)

Followed the instructions below from: Configure VERP to handle bouncing e-mails. NB the SNS URL for me was https://eu-west-2.console.aws.amazon.com/sns/v3/home?region=eu-west-2#/dashboard

Chose not to “Enable raw message delivery” (hope that was right).

Didn’t have to rebuild:

Discourse - Admin - Email - Email settings - Preview summary - I used this to test emails, to valid and non-existent recipients.

Tested at https://www.mail-tester.com/ - 10/10 :slight_smile:

Discourse - Admin - Email - Email logs. Useful to check. Incidentally the error at "Discourse::NotFound" error when click "Email Type" field on admin/email/bounced no longer occurs.

Tested whether new topic sent notification email as expected.

Tested whether reply by email sent reply to that topic.

1 Like