Setting up bounces handling
Discourse uses the
VERP technique to handle bouncing e-mails.
To enable VERP, set the “reply by email address” site setting with an email address template that uses the + sign. The default of
… works fine. If you are using your own or your company’s email server, then, that’s it
Your discourse instance must be able to receive email sent to this address. This should work via POP, but we highly recommend Direct-del…
I followed the instructions linked above and set up SES with SNS email forwarding. I’m running into two problems.
1. Rejected/complaint emails not being received by Discourse
I’m currently receiving a spike in SES email complaints so I really need to be receiving and handling email rejections. However, setting it up with the above instructions does not yield any results in the email rejected tab even though bounces are coming through.
Even when I send emails to
SES’s mailbox simulator, no rejected emails show up.
2. Bounced email details showing a
When I click the (i) icon in any bounced email row, it gives me an error.
With the email logging setting turned on and checking the /logs url, I am not able to find anything obviously wrong in the logs when using the filter term “mail”.
This seems to be the case regardless if I have SES’s “Include original headers” setting turned on or not.
Related topics I found
I think clicking on an “Email Type” field, e.g. user_watching_first_post is meant to display details of the bounce message received from the intended recipient.
But on my self-hosted site I get the error message stated above. Is there anything I can do to fix this?
I was aware that Discourse offers an endpoint to handle SNS notifications from Amazon SES. The endpoint is /webhooks/aws, and here is where I got aware of it:
Everything is “almost” working. I can see that AWS is sending the notifications to that endpoint, via CloudWatch log. I also see that Discourse is responding the notification with successful status code (200), after I configured it to send the raw message.
However, the e-mail doesn’t appear in the list of “Bounced” e-mails in Discourse…
digging through web archive because I’m stubborn and want to see the deleted messages on the setup instructions lol
Handling bouncing e-mails - admins - Discourse Meta
@renato looks like you figured out the latest setup instructions for SES email forwarding. Have you encountered the issues I’m facing at all?
Discourse is an amazing forum but it’s email handling is a bit haphazard. I’ve given up on searching for answers or achieving perfection, as haphazard has been good enough. But I would still be interested in the answers to your questions, partly because I am considering moving from Mailgun to the cheaper Amazon SES.
This is what I’m currently doing as a manual workaround for rejections. But I’d still love to figure out the ‘right’ solution for both rejections and bounces in SES.
SES also doesn’t report complaint emails by default. Use these instructions to hook it up to CloudWatch to gather more info.
How to Log Amazon SES details using Amazon CloudWatch | AWS Messaging & Targeting Blog (I had to manually update the included template to a newer version of Python to make it work)
This creates a CloudWatch > Logs > Log groups item for complaint emails, assuming you selected this option. You can see a list of emails sent and dig in to see the exact email address.
And then you can use CloudWatch > Log Insights to query the data for a simpler summary.
Make sure to set your time span to what you want to look at. This resets on every page load.
I saved the below query for future use. You can find it in the right bar > queries > saved queries. But it’s kind of hard to see it. Ctrl+F if needed.
fields complaint.complainedRecipients.0.emailAddress as email
| limit 500
| stats count(*) as count by email
| sort count desc
Yeah, the configuration has worked for me in the past when I made that post, but it has been broken for some time now, I don’t see any bounced e-mails on Discourse anymore.