Skip to main content

Mailgun

Mailgun sends the email of your site from its own servers and tells your site when an address fails for good or marks your email as spam, so no email goes to it again.

You need a Mailgun account and a domain to send from. How Email delivery works for every way is on Email delivery.

1. Add your sending domain​

In Mailgun, go to Sending → Domains and add a domain to send from, such as mg.example.com, in the region you choose, US or EU. Add the records Mailgun shows at the DNS of your domain and wait until it says the domain is verified.

A new account has a sandbox domain too. It sends only to the few addresses you list as authorized recipients in Mailgun, which suits a first try, not your members.

2. Make an API key​

Under your account menu, open API Security (the API keys of the account) and make a key, or copy the private API key. Keep it to yourself: anyone who has it can send as your site.

3. Enter the key​

  1. In WordPress, go to Poly Community → Settings → Services → Email delivery.
  2. Under Send with, press Change, then Mailgun.
  3. Paste the key into API key.
  4. Enter the Sending domain exactly as Mailgun lists it, such as mg.example.com.
  5. Choose the Region of the domain, US or EU. A domain made in the EU region is not found through the US one.
  6. Set the Sender address to an address at that domain, and press Save changes.
Email delivery with Mailgun: the API key kept, the sending domain, the region, the webhook signing key and the webhook address
Settings → Services → Email delivery, Mailgun

Mailgun is sent as a form, without attachments. Your site sends no email with attachments of its own, so this only matters for email another plugin sends with files.

4. Add the webhook​

  1. In Mailgun, under API Security, copy the HTTP webhook signing key, paste it into Webhook signing key in WordPress and save.
  2. Copy the Webhook address from the screen.
  3. In Mailgun, go to Sending → Webhooks, choose your domain, and add that address for Permanent Failure and for Spam Complaints.

Your site takes only events signed with that key. From then on, an address that fails for good or marks your email as spam goes on Never sent to. A temporary failure, which Mailgun tries again, does not.

5. Send a test​

Press Send me a test email. The status at the top says Sent through Mailgun, and the email shows in the Logs of Mailgun, then in your inbox. If the status says the domain was not found, check the sending domain and the region.