VERPを設定してバウンスメールを処理する

バウンス処理の設定

Discourse は、バウンスしたEメールを処理するために Variable envelope return path (VERP) という技術を使用しています。

VERP を有効にするには、「reply by email address」サイト設定を、+ 記号を使用するEメールアドレスのテンプレートに設定します。デフォルトの

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

…で問題ありません。ご自身または会社のEメールサーバーを使用している場合は、これで完了です :tada:

お使いの Discourse インスタンスは、このアドレスに送信されたEメールを受信できる必要があります。これは POP 経由で機能するはずですが、セルフホストサイトのダイレクト配信着信メール を強くお勧めします。

ただし、サードパーティのEメールサービスを使用している場合は、VERP を有効にするか、以下の方法でWebhookを有効にする必要があります。

MailGun

  1. MailGun にログインし、ダッシュボード に移動します。左側の列で SendingWebhooks ページを探します。
  2. Configuration タブを選択し、HTTP signing key をコピーします。
  3. Discourseサイト内で、Mailgun API key サイト設定に、コピーしたHTTP signing keyを設定します。
  4. Mailgun に戻り、Add webhook ボタン(Domain-level を選択)をクリックし、HTTP post URLhttps://your.discourse/webhooks/mailgun に設定します。これをテストします。
  5. Permanent FailureTemporary failure の両方を選択し、ドメインを再確認してから、Webhook を作成します。

SendGrid

  • SendGrid にログインし、Mail Settings に移動します。
  • Event Webhook 設定を展開し、まだ有効になっていない場合は有効にします。
  • edit をクリックして、HTTP POST URLhttp://your.discourse/webhooks/sendgrid に設定します。
  • 以下の3つのアクションを選択したことを確認します: DroppedDeferredBounced
  • :white_check_mark: をクリックして変更を保存します。

MailJet

  • MailJet にログインし、event tracking に移動します。
  • bounce イベントにチェックを入れます。
  • endpoint URLhttp://your.discourse/webhooks/mailjet に設定します。
  • group events 列の :white_medium_square: にチェックを入れます。
  • save ボタンをクリックします。

SparkPost

  • SparkPost にログインし、ダッシュボード に移動します。
  • 左側のメニューアイコンから Account を選択します。
  • メニューから Webhooks を選択します ( SparkPost )。
  • New Webhook を選択します。
  • Webhook NameDiscourse Forum のようなわかりやすい値を入力します。
  • Target URL として http://your.discourse/webhooks/sparkpost を入力します。
  • Add Webhook を選択します。

Amazon Simple Email Service (AWS SES)

  • Discourse側:
    • 上記に従って reply by email enabledreply by email address を設定します。
    • manual polling enabled を設定します。
  • AWS側:
    • SNS トピックを作成します。
    • 作成したトピックに対して、HTTPS で https://your.discourse/webhooks/aws を指す SNS サブスクリプションを作成します。
    • SES → Verified Identities に移動し、サイトのドメインを選択し、Notifications タブに移動します。フィードバック通知を編集します。Bounce feedback と Complaint feedback を、作成した SNS トピックに設定します。

Postmark

  • Postmark にログインし、Discourse のメール送信に使用される server を選択します。
  • Discourse のメールに関連付けられているメッセージストリーム、通常は Default Transactional Stream を選択します。
  • Webhooks をクリックします。
  • Add webhook をクリックします。
  • Webhook URL として http://your.discourse/webhooks/postmark を入力します。
  • Which events should we send? の下で、DeliverySpam complaint にチェックを入れます。
  • 下にスクロールし、Save webhook をクリックします。

バウンスのテスト

すべてが機能していることを確認するために、次を実行します。

  1. サイトで、明らかに間違ったEメール形式(例: bademail@obviously-invalid-domain.com または clearly.nobody.has.this.email.address@gmail.com)で新しいアカウントにサインアップします。
  2. メールが完全にバウンスするまでしばらく待ちます (必要であればプロバイダーのログを確認してください – 通常は「warn」または「error」ログレベルに表示されます)。
  3. サイトの /admin/email/bounced を確認し、バウンスが検出されたことを確認します。Eメールプロバイダーのリトライ回数や特定のロジックによっては、最大48時間かかる場合があることに注意してください。

バウンスの設定

バウンス処理は、これらのサイト設定を使用してカスタマイズできます。

  • soft bounce score: 一時的バウンスがEメールアドレスから受信されたときに、ユーザーの「バウンススコア」に追加されるポイント数。
  • hard bounce score: 永続的 (または不明) バウンスが受信されたときに、ユーザーの「バウンススコア」に追加されるポイント数。
  • reset bounce score after days: ユーザーの「バウンススコア」を 0 にリセットするまでに、バウンスを受信しない日数。
  • bounce score threshold: 緊急ではないメールをユーザーに送信するのを停止するスコアしきい値。

最終レビュー: @SaraDev 2022-07-19T20:00:00Z

「いいね!」 51
Does Discourse use Mailgun's validations feature?
VERP bounce replies ignored when using Mailgun
Postmark bounce support?
Email-in replies thread wrongly
Amazon SES/SNS email complaints not received, bounces missing information
What mail service do you recommend?
Confused about VERP, email bounces & additional setup on Discourse
Reply-by-Email was working, now broken
Mailgun "temporarily disabled due to high bounce rate"
How to deactive account of those users who're not receiving emails
Surface data about users with too many bounces
"Discourse::NotFound" error when click "Email Type" field on admin/email/bounced
Configure direct-delivery incoming email for self-hosted sites with Mail-Receiver
"Discourse::NotFound" error when click "Email Type" field on admin/email/bounced
Bounced Email Info Not Found
Fix AWS SNS Bounce
How to block outgoing emails to at anon.forumurl?
Mailgun api key check backward (no API key should be required if bounces handled by mail receiver)
Switching from SMTP to oAuth
Is handling bouncing emails optional, or is it something I definitely need to set up?
Moving from Mailgun to Amazon SES as an amateur
"Discourse::NotFound" error when click "Email Type" field on admin/email/bounced
Mailgun api key, what is it for?
Question about the mail-receiver
Goodbye Sparkpost
Migrated forum with many invalid (bouncing) emails
Amazon SES API - How to setup?
Zero entries in bounced email list
Email suppression list handling
Email suppression list handling
How hard is it to handle Discourse after installation
Set up mail-receiver, but now site won't send any emails?
Installation by the book
Too many user emails domains not working lead to mailgun domain disabled: what to do?
Mailgun huge dropped subscriber
Flush bouncing user mail address
Configuring AWS SES for outgoing, bounce, and incoming email
Notes on Silencing or Deleting users
Retrying bounced emails?
Discourse Mailgun Routes
"Discourse::NotFound" error when click "Email Type" field on admin/email/bounced