Configure Mailgun for outbound emails

Mailgun configuration is pretty simple. To enable Mailgun for outgoing emails, look for MAIL_DRIVER on the .env file, and change its value to mailgun. Then, add the following to the .env file:

MAILGUN_DOMAIN=yourmailgundomain.com
MAILGUN_SECRET=apikey

Remember to replace yourmailgundomain.com and apikey with your own Mailgun values. The apikey starts with key-* and can be found in the API Security section under the Private Key section in your Mailgun account.

If your Mailgun's outbound domain is located at Mailgun's EU region, add MAILGUN_ENDPOINT=api.eu.mailgun.net to the .env file.

Please note: For emails to be sent, the queues system should be configured and running. 

Keep track of delivery status and bounces

Register the following two API Webhooks in your Mailgun account so the system can keep track of message delivery failures:

  1. In your Mailgun account, go to Webhooks
  2. Click on Add Webhook
  3. On Event Type, select Permanent Failure
  4. On URL, enter https://www.yourdomain.com/api/v1/mg/events

To track temporary failures, repeat step 3 and 4. On step 3, select Temporary Failure. On Step 4, enter the same URL.

With this, your system will start tracking the delivary status for all messages sent from your help desk. 

Your vote was sent, thanks!
Was this article helpful?

Want to talk to a human?

Feel free to contact us if you cannot find what you are looking for in our help center. We will be answering you shortly!

Feel free to contact us if you cannot find what you are looking for in our help center. We will be answering you shortly!

Contact us
Woman messaging on mobile phone