تكوين VERP للتعامل مع رسائل البريد الإلكتروني المرتدة

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 إعجابًا

إذا أراد شخص ما اختبار هذا وتأكيد أنه يعمل، فسأضيفه إلى المنشور الأصلي.

إنشاء خطافات الويب الخاصة بـ Mailgun

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

تم تحديث قسم Mailgun حيث تغيرت الأشياء قليلاً في واجهة المستخدم الخاصة بهم:

4 إعجابات

هل هناك طريقة بسيطة للتعامل مع شكاوى البريد الإلكتروني تلقائيًا باستخدام VERP حاليًا؟ في حالة المستخدمين الذين لا يلغون الاشتراك ولكنهم ببساطة يضعون علامة على البريد الإلكتروني كرسائل غير مرغوب فيها. من المهم جدًا التوقف عن إرسال رسائل بريد إلكتروني إلى الأشخاص الذين يشتكون.

إعجابَين (2)

للعلم فقط لجميع ذوي المهارات المنخفضة: جزء SES قديم جدًا، على ما أعتقد.

فقط لا تختر FIFO حتى لو تم اقتراحه :man_facepalming:

إعجاب واحد (1)

مرحباً @pfaffman ، شكراً لمشاركتك هذا ولكن مساعدة سريعة من فضلك

ماذا لو كنت أستخدم مزود بريد إلكتروني آخر بدلاً من القائمة السابقة، هل هذا لا يزال ممكناً؟

إعجابَين (2)

في سجلاتي، أنتج نقطة النهاية webhooks/mailjet تحذيرًا:

تم استلام خطاف Mailjet، ولكن لم يتم تكوين أي رمز مميز. هذا سلوك غير آمن وسيتم حظره في المستقبل.

في /admin/site_settings/category/email?filter=mailjet يوجد حقل “رمز Mailjet webhook”، بدون تعليمات حول كيفية إعداده بشكل صحيح.

ذهبت إلى Mailjet وأضفت إلى حقل Endpoint URL: https://discourse.example.org/webhooks/mailjet?t=[your_token]

استبدلت [your_token] بواحد تم إنشاؤه بواسطة مولد الرموز المميزة، وأدخلت نفس القيمة في حقل “رمز Mailjet webhook” في /admin/site_settings/category/email?filter=mailjet.

يبدو أن هذا قد أزال تحذيرات السجل.

إعجاب واحد (1)

أردت فقط أن أشير إلى أنني أكدت أن شكاوى البريد العشوائي لـ AWS SES يتم إرسالها من complaints@email-abuse.amazonses.com إلى “عنوان الرد عبر البريد الإلكتروني” (في إعدادات Discourse) ويتم التعامل معها على أنها عمليات إرجاع صعبة بواسطة Discourse حاليًا عبر تكوين VERP القياسي (بدون خطافات الويب SNS).

لقد وجدت هذا للتو، والذي قد يكون مفيدًا للبعض ممن يستخدمون SES أيضًا (قسم “استخدام محاكي صندوق البريد”):

يمكنك استخدام “إرسال بريد إلكتروني تجريبي” داخل مسؤول Discourse لإرسال إلى عناوين محددة ستحاكي أشياء مثل الارتداد والشكاوى دون الإضرار بسمعة الإرسال لديك.

على سبيل المثال:

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

هناك عناوين اختبار أخرى في الرابط أعلاه.

إعجاب واحد (1)