# Configure VERP to handle bouncing e-mails

**URL:** https://meta.discourse.org/t/configure-verp-to-handle-bouncing-e-mails/45343
**Category:** Self-Hosting
**Tags:** email, how-to
**Created:** [June 6, 2016, 10:53pm UTC](https://meta.discourse.org/t/configure-verp-to-handle-bouncing-e-mails/45343 "2016-06-06T22:53:31Z")
**Posts on this page:** 1
**Showing post:** 1

<div class="post-metadata">

### Author: ![Discourse](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/discourse/32/148734_2.png) [@Discourse](https://meta.discourse.org/u/Discourse)
#### Post date: [June 6, 2016, 10:53pm UTC](https://meta.discourse.org/t/configure-verp-to-handle-bouncing-e-mails/45343/1 "2016-06-06T22:53:32Z")

</div>

## Setting up bounces handling

Discourse uses the [Variable envelope return path (VERP)](https://en.wikipedia.org/wiki/Variable_envelope_return_path) 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 🎉

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](https://meta.discourse.org/t/straightforward-direct-delivery-incoming-mail/49487)

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](https://app.mailgun.com/app/dashboard); look in the left column for the **Sending** → **Webhooks** page.
2. Select the **Configuration** tab and copy the **HTTP signing key**
3. In _your Discourse site_, set the **Mailgun API key** site setting with your **HTTP signing key**
4. Back in Mailgun, click the **Add webhook** button (selecting **Domain-level** ) and set the **HTTP post URL** to `https://your.discourse/webhooks/mailgun`. Test this.
5. Select both `Permanent Failure` and `Temporary failure`, double check the Domain, and then Create Webhook.

### SendGrid

- Log in to SendGrid and go to [Mail Settings](https://app.sendgrid.com/settings/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 ✅

### MailJet

- Log in to MailJet and go to [event tracking](https://app.mailjet.com/account/triggers)
- check the **bounce** event
- set the **endpoint URL** to `http://your.discourse/webhooks/mailjet`
- check the ◻ in the **group events** column
- click the save button

### SparkPost

- Login to SparkPost and go to [your dashboard](https://app.sparkpost.com/dashboard).
- Select **Account** from left menu icons
- Select **Webhooks** from menu ( [SparkPost](https://app.sparkpost.com/account/webhooks) )
- 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_

> Last edited by @nathank 2026-03-18T23:42:58Z
> 
> > **Check document**
> >
> > Perform check on document:

---

_[View the full topic](https://meta.discourse.org/t/configure-verp-to-handle-bouncing-e-mails/45343)._
