Konfigurieren Sie VERP, um Rückläufer-E-Mails zu verwalten

Setting up bounces handling

Discourse uses the Variable envelope return path (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

replies+%{reply_key}@discourse.example.com

… works fine. If you are using your own or your company’s email server, then, that’s it :tada:

Your discourse instance must be able to receive email sent to this address. This should work via POP, but we highly recommend Direct-delivery incoming email for self-hosted sites

If, however, you are using a third party email service, you will need to enable VERP, or activate their webhooks as follows:

MailGun

  1. Log in to MailGun and go to your dashboard; look in the left column for the SendingWebhooks page.
  2. Make sure that the correct Domain is selected (top right on desktop)
  3. In Discourse, set the mailgun api key site setting with your HTTP webhook signing key
  4. Click the Add webhook button, set the “Event Type” menu to “Permanent Failure”, and set the URL to https://your.discourse/webhooks/mailgun
  5. Repeat the Add webhook portion, choosing “Temporary Failure” as the “Event Type”
    • :exclamation: there is a “Test webhook” section which is useful for testing, but doesn’t save - make sure you use the Add webhook button instead

SendGrid

  • Log in to SendGrid and go to Mail Settings
  • expand the Event Webhook setting and enable it if it isn’t already
  • click edit to set the HTTP POST URL to http://your.discourse/webhooks/sendgrid
  • make sure you selected the following 3 actions: Dropped, Deferred and Bounced
  • save your changes by clicking the :white_check_mark:

MailJet

  • Log in to MailJet and go to event tracking
  • check the bounce event
  • set the endpoint URL to http://your.discourse/webhooks/mailjet
  • check the :white_medium_square: in the group events column
  • click the save button

SparkPost

  • Login to SparkPost and go to your dashboard.
  • Select Account from left menu icons
  • Select Webhooks from menu ( SparkPost )
  • Select New Webhook.
  • Enter a friendly value for Webhook Name e.g. Discourse Forum
  • Enter a Target URL as http://your.discourse/webhooks/sparkpost
  • Select Add Webhook.

Amazon Simple Email Service (AWS SES)

  • On Discourse:
    • set reply by email enabled and reply by email address as per the top of OP
    • set manual polling enabled
  • On AWS:
    • create an SNS Topic
    • create an SNS Subscription for the created Topic as HTTPS pointing to https://your.discourse/webhooks/aws
    • go to SES > Verified Identities, select your site domain, and go to the Notifications tab. Edit your Feedback Notifications. Set the Bounce feedback and Complaint feedback to the SNS Topic you just created

Postmark

  • Login to Postmark and then select the server that is used for sending Discourse emails
  • Select the message stream associated with Discourse emails, typically Default Transactional Stream
  • Click Webhooks
  • Click Add webhook
  • Enter Webhook URL as http://your.discourse/webhooks/postmark
  • Under, Which events should we send?, check Delivery and Spam complaint
  • Scroll down and click Save webhook

Testing Bounces

To ensure that everything is working, do this:

  1. Sign up for a new account on your site with an obviously incorrect email, of the form bademail@obviously-invalid-domain.com or clearly.nobody.has.this.email.address@gmail.com
  2. Wait a while for the emails to fully bounce (check your provider’s logs, if you want – they will usually be shown under the “warn” or “error” log level)
  3. Check /admin/email/bounced on your site to confirm that the bounce was picked up. Bear in mind this may take up to 48 hours depending on how many retries and the particular logic of your email provider.

Configuring Bounces

Bounces handling can be customized using these site settings

  • soft bounce score: points added to the user’s “bounce score” when we receive a temporary bounce from their email address
  • hard bounce score: points added to the user’s “bounce score” when we receive a permanent (or unknown) bounce from their email address
  • reset bounce score after days: number of days during which we must receive no bounce before we can reset the user’s “bounce score” back to 0
  • bounce score threshold: score threshold at which point we will stop sending non urgent emails to the user

Last Reviewed by @SaraDev on 2022-07-19T20:00:00Z

51 „Gefällt mir“

Wenn jemand dies testen und bestätigen möchte, dass es funktioniert, füge ich es in den OP ein.

Mailgun-Webhooks erstellen

for event_type in 'permanent_fail' 'temporary_fail'; do
curl -s --user 'api:'=mg_api_key= \
          https://api=mg_region=.mailgun.net/v3/domains/$discourse_hostname/webhooks \
          -F id="$event_type" \
          -F url="https://=discourse_hostname=/webhooks/mailgun"
done

Die Mailgun-Sektion wurde aktualisiert, da sich deren Benutzeroberfläche ein wenig geändert hat:

4 „Gefällt mir“

Gibt es derzeit eine einfache Möglichkeit, E-Mail-Beschwerden mithilfe von VERP automatisch zu bearbeiten? Für den Fall von Benutzern, die sich nicht abmelden, sondern die E-Mail einfach als Spam markieren. Es ist von entscheidender Bedeutung, Personen, die sich beschweren, keine E-Mails mehr zu senden.

2 „Gefällt mir“

Nur zur Information für alle mit geringen Kenntnissen: Der SES-Teil ist meiner Meinung nach schlecht veraltet.

Wählen Sie einfach nicht FIFO, auch wenn es vorgeschlagen wird :man_facepalming:

1 „Gefällt mir“

Hallo @pfaffman, danke für das Teilen, aber schnelle Hilfe bitte.

Was ist, wenn ich einen anderen E-Mail-Anbieter als die vorherige Liste verwende, ist das trotzdem möglich?

2 „Gefällt mir“

In meinen Protokollen gab der Endpunkt webhooks/mailjet eine Warnung aus:

Mailjet-Webhook empfangen, aber kein Token konfiguriert. Dies ist unsicheres Verhalten und wird in Zukunft nicht mehr zugelassen.

Unter /admin/site_settings/category/email?filter=mailjet gibt es das Feld „Mailjet-Webhook-Token“ ohne Anweisungen zur korrekten Einrichtung.

Ich bin zu Mailjet gegangen und habe in das Feld „Endpoint URL“ Folgendes eingegeben: https://discourse.example.org/webhooks/mailjet?t=[your_token]

Ich habe [your_token] durch einen ersetzt, der von einem Token-Generator generiert wurde, und denselben Wert in das Feld „Mailjet-Webhook-Token“ unter /admin/site_settings/category/email?filter=mailjet eingegeben.

Das scheint die Protokollwarnungen beseitigt zu haben.

1 „Gefällt mir“

Ich wollte nur anmerken, dass ich bestätigt habe, dass Spam-Beschwerden für AWS SES von complaints@email-abuse.amazonses.com an die „Antworten per E-Mail-Adresse“ (in den Discourse-Einstellungen) gesendet werden und derzeit über die Standard-VERP-Konfiguration (ohne SNS-Webhooks) als Hard Bounces von Discourse behandelt werden.

Habe gerade das hier gefunden, was für einige, die auch SES nutzen, nützlich sein könnte (der Abschnitt ‘Verwendung des Postfachsimulators’):

Man kann die Funktion ‘Test-E-Mail senden’ im Discourse-Admin verwenden, um an bestimmte Adressen zu senden, die Dinge wie Bounces und Beschwerden simulieren, ohne die Sendeberechtigungen zu beeinträchtigen.

z.B.

bounce@simulator.amazonses.com
complaint@simulator.amazonses.com

Weitere Testadressen finden Sie im obigen Link.

1 „Gefällt mir“