Handling bouncing e-mails

(Cameron:D) #43

Is your Mailgun API key correctly set? Just search your site settings for Mailgun.

1 Like

(Scott Stillwell) #44

So, parts of this seem obvious, and other parts…not so much. I’m self-hosted for email on a separate host from my Discourse box/container, and inbound and outbound emails work properly for my email forums@domain.tld. Forums is obviously a mailbox on the mail host (Postfix with Dovecot POP/IMAP) and it can authenticate and send/receive email as needed. DNS/RDNS, SPF, and DKIM are all set up and I generally don’t have problems with receipt or delivery of email.

Instructions say to set up a VERP-style address, and I have all the parameters set in Postfix to handle transmitting those emails, but it also says that it must use a DIFFERENT address like “replies+%{reply_key}@domain.tld”. replies@ is NOT a mailbox on this server, and there is no place to specify in Discourse how to access that mailbox - how is it ever going to tell there’s a bounce message? I’ve tried using forums+%{reply_key}@domain.tld but I’m blocked from saving as it says it can’t be the same address (running recent Discourse v2.1.0.beta1 +60).

When I try to send any email with the reply to address set as described above, I get

 [Sender] 550 5.1.0 <replies+verp-5f7576dcd9e86b44edc92d667a9bbf27@domain.tld>: Sender address rejected: User unknown in virtual mailbox table

which I pretty much expected.

Ideas? I know I must be missing something here, but I don’t know what I don’t know.


(Matt Palmer) #45

Tell Postfix that replies@example.com is a virtual alias for forums@example.com.


(Scott Stillwell) #46

Wow, I should have thought of that. Bingo. I’m now able to send email with a reply to address set, and I’m testing bogus email addresses and should see if bounces work properly in 24-48 hours or so.

Thank you so much!


(Scott Stillwell) #47

Another piece of information that may be useful to others - if you’re using Postfix + Dovecot, a lot of default installations (iRedMail, for instance) will have Postfix’s call to Dovecot set to deliver plus-addressed mail to folders in your mailbox rather than the default INBOX. so, you’ll wind up with MANY folders starting with ‘verp-’ and the POP polling of the inbox won’t necessarily pick those emails up.

See LDA/Postfix - Dovecot Wiki section “Virtual Users” about Dovecot LDA (but also pertinent if you’re using just plain Dovecot ‘deliver’) and see how to remove the -m ${extension} parameter and add the -a ${original_recipient} parameter to have it deliver with unmodified recipient information directly into the inbox. Note that if your mail users are already using plus addressing to filter email into folders and you change it, you’re likely to upset people, but in my case it was an acceptable change.

1 Like

(Michał Frąckiewicz) #48

@zogstrip Is there any chance for AWS SNS integration for SES in Discourse?

If I understand correctly, VERP needs enabling incoming email in Discourse, it’s not feasible in some situations, may complicate config a little, webhooks are simpler and have more info about what bad happened to sent email.

1 Like

(Régis Hanol) #49

Sure, can you point me to the documentation?


(Michał Frąckiewicz) #50

Should be this one:

One of apps I use have this kind of integration, maybe source can tell better/faster how to do it :slight_smile:


(Elive Linux) #52

Is there a way to configure in discourse to manage some received emails to be forwarded to a specific address? for example on my case i need to made postmaster@forum.example.com to be sent to one of the admin’s email address


(Jay Pfaffman) #53

Create a group and have that group handle mail for postmaster.


(Elive Linux) #54

I have checked that but i don’t see any email-related configuration when creating a group, which option I need to look for?



Hi @zogstrip - thanks for the guides!

I set up Amazon SES bounces as described using VERP, including this receiving email guide:

I see the bounce emails in /admin/email/received in the admin area, but they aren’t showing the the bounced section /admin/email/bounced

Is this expected behavior? Or is there something not working correctly?


(Régis Hanol) #56

They should show up in /admin/email/bounced but it might take a couple of days before you get the bounce back.



Edit: This was my mistake, I didn’t set the “reply by email address” correctly. Working perfect now! Thanks for the help.

1 Like


One more thing, does this VERP feature handle spam complaints for Discourse as well?


(Jeff Atwood) #59

Describe how you think that would work, step by step, with a real world example?

1 Like


Sure @codinghorror,

When a user marks an email as spam, the complaint is often sent back to the SMTP provider using a feedback loop. This information is generally available for the SMTP account owner and should send the notification via webhook, VERP or the info will be available via API.

So ideally would be good to disable all emails to that user permanently. If they didn’t want the emails, they could simply unsubscribe. But marking as spam they are essentially saying that this is not opt-in email and spam.

A real world example is Aweber, if you mark any email from Aweber as spam, you will be removed from all Aweber mailing lists (regardless of different account owners) and never be able to re-subscribe to any Aweber lists again.

Another real world example is many companies maintain a ‘suppression list’ of people not to email due to marking their emails as spam.

Handling spam complaints is even more important than bounces. Ignoring spam complaints and continuing to email the same user is a big no-no for your email reputation.

Hope this helps, thanks.

1 Like

(Matt Palmer) #61

If Discourse not handling spam complaints is causing you problems, feel free to submit a PR to add support for it.



@mpalmer Thanks for the suggestion but I’m not a developer unfortunately, I was just asking if they were handled or not. I assumed it was a given seeing the complaints appear to be sent via the same method as bounces. All legit SMTP services will have some method to access your spam complaints.

Here is an excerpt from Amazon SES:


Most email client programs provide a button labeled “Mark as Spam,” or similar, which moves the message to a spam folder, and forwards it to the ISP. Additionally, most ISPs maintain an abuse address (e.g., abuse@example.net), where users can forward unwanted email messages and request that the ISP take action to prevent them. In both of these cases, the recipient is making a complaint. If the ISP concludes that you are a spammer, and Amazon SES has a feedback loop set up with the ISP, then the ISP will send the complaint back to Amazon SES. When Amazon SES receives such a complaint, it forwards the complaint to you either by email or by using an Amazon SNS notification, depending on how you have your system set up. For more information, see Monitoring Using Amazon SES Notifications. We recommend that you do not make repeated delivery attempts to email addresses that generate complaints.



(Matt Palmer) #64

Discourse handles bounces. Most other things are a function of your e-mail service provider, and how Discourse integrates with that e-mail service provider, as demonstrated by the fact that you’re quoting from the documentation of an e-mail service provider.