Handling bouncing e-mails


(David Taylor) #33

If ElasticEmail supports the VERP standard, then discourse should be able to interpret bounces correctly. This is how I handle Amazon SES bounce detection

So the question is whether their “forwarding” of bounced emails conforms to the spec…


(Alexey Lustin) #34

Wthat about Mandrill ?

in master i see this config discourse/webhooks_controller.rb at master · discourse/discourse · GitHub for Mandrill

but it not working with our instance

  • currently after we create WebHook - Discource redirect Mandrill from https://our-discource/webhooks/mandrill to https://our-discource/login

we have a Discource with disable anonymous access


(Stephen Chung) #35

Does the bounce email webhook work without the reply key?

I use Sendgrid to send but my incoming pop3 is a different server which doesn’t support the + suffix.

So I was forced to turn off reply keys and use just a standard reply to address. Threads are sorted via the In Reply To header.

I understand that using Sendgrid with the webhook requires reply keys to work?


(Michael Howell) #36

It works for me with combining the return-path webhook (using Mailgun to send email from my main domain) and a reply-to handler with no + sign (using the local SMTP server to receive email on the forum subdomain).


(ljpp) #37

Sorry for not getting it.

So I enable this and somehow configure SES to forward bounces to an accound, and make Discourse POP poll the account for bounces?

Would someone kindly document the SES process, step by step.


(David Taylor) #38

Make sure you have this bit done:

Your discourse instance must be able to receive email sent to this address. This should work via POP, but I highly recommend Straightforward direct-delivery incoming mail

Then for AWS I followed these steps:

  • Log in to the AWS console, and go to Simple Email Service (SES)
  • Under Domains, find the one you use for your forum, and click it
  • Under the Notifications section, click “Edit Configuration”
  • All of the SNS settings can be set to “No SNS Topic”
  • Under “Email Feedback Forwarding”, choose Enabled

I will add those steps to the #howto above :slight_smile:


As an aside, make sure you are aware of this issue when using SES with Discourse:


(Philip Colmer) #39

One little tip that caught us out (we’re using SES to send but Google Mail to receive) - make sure that the received emails are not being treated as spam. If they are, Discourse doesn’t see them.

I had to add a filter to the GMail mailbox to ensure that emails from MAILER-DAEMON@amazonses.com are never treated as spam.


(Colin Marshall) #40

@tophee did you manage to get this working with Elastic Email? If so, I would appreciate it if you could describe the steps you took so it could be added to the first post in this topic. Thanks!


(Christoph) #41

No, I’m using Mailgun instead. I don’t think EM is suitable for use with Discourse.


#42

After setup bouncing e-mails, outlook mails gives that error:

failed: postmaster@mail.gameofthronestr.com → https://forum.gameofthronestr.com/webhooks/mailgun Server response: 406


(Cameron:D) #43

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


(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.


(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.


(Régis Hanol) #49

Sure, can you point me to the documentation?


(Michał Frąckiewicz) #50

Should be this one:
https://docs.aws.amazon.com/ses/latest/DeveloperGuide/notifications-via-sns.html

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.