Configure authentication checks on incoming email

AI-generated summary

LeoMcA announces that Discourse now supports parsing Authentication-Results headers for incoming emails, specifically checking DMARC, SPF, and DKIM records to verify sender authenticity. To enable this, administrators must configure the email_in_authserv_id setting. The correct value can often be determined by sending a test email to the instance, viewing the raw email headers, and extracting the domain found between the colon and semicolon in the Authentication-Results line (e.g., amazonses.com). LeoMcA also lists well-known values for common providers like Gmail (mx.google.com) and Amazon SES.

Regarding how to view these headers, akhilgeothom initially struggled to find the raw email data. akhilgeothom later noted that clicking the error message in Settings > Email > Rejected provides the necessary details. However, ToddZ reported that their test rejected emails lacked the Authentication-Results header entirely, despite SPF/DKIM/DMARC being correctly configured elsewhere, questioning if the instructions remain accurate. Dannii asked whether this feature applies only to POP3 polling or if it also supports the mail-receiver component. The discussion highlights that while the feature helps prevent spoofing, its visibility in headers and applicability across different email intake methods may vary depending on the configuration.

As of this commit, Discourse now supports parsing the Authentication-Results header of incoming emails. This header contains information about whether we can trust that an email is actually coming from the person who claims to be sending it.

At the moment, Discourse just parses the DMARC results of a message. This header also includes SPF and DKIM records (which are required for DMARC to function). These acronyms should be familiar to you if you’ve set up outgoing email on your Discourse instance, as they’re required to ensure proper delivery of your email notifications. We’re using these same methods that external services use to ensure that email claiming to be from your Discourse instance actually is from your Discourse instance, to ensure that email claiming to be from external services is actually coming from those external services.

:warning: Configuring the authserv-id :warning:

For this all to function correctly you need to set the authserv-id of your incoming email processor in the email_in_authserv_id setting.

If your service isn’t in the “well known values” list below, then you’ll have to do some manual parsing of incoming email to work out the correct setting. The best way to do this is to send an email to your Discourse instance yourself, since you can then trust that it was really you who sent it, and you haven’t forged any of the email headers.

Open the raw email in Discourse, then search for the line starting Authentication-Results:, the domain you see between the : and ; is the authserv-id.

As an example:

Authentication-Results: amazonses.com;

Then copy this value (without the ;) into your email_in_authserv_id setting, and you’re good to go!

Well known values:

If you use one of these services, copy the value into your email_in_authserv_id setting to enable authentication checks on incoming email:

  • Gmail/G Suite: mx.google.com
  • Amazon SES: amazonses.com
13 Likes

Open the raw email in Discourse, then…

Could someone tell me how I can do this please?

Settings>Email>Received only allows to see the subject of the mail after sending the mail to replies@example.com as in this thread.

Go to Settings>Email>Rejected. Clicking on the error message gives everything.

1 Like

Are these instructions still accurate? I have no Authentication-Results: line in the headers of test (rejected) incoming emails. All my SPF/DKIM/DMARC settings seem to check out elsewhere, so I’m not sure if I’m missing something.

Is this only for receiving mail with POP3 polling, or can it also be used with the mail-receiver?