Skip to main content
Version: 19

Mailgun email provider

🎯 Functional documentation​

Sends the email through the messages API of Mailgun. resourceUri holds the Mailgun API without a version, which is https://api.eu.mailgun.net for a domain created in the European region and https://api.mailgun.net for one created in the American region. API_KEY holds a Mailgun sending key and MAIL_DOMAIN the Mailgun domain the email is sent from, which should be verified in Mailgun before it can send anything.

The email is sent from MAIL_SENDER, whose domain does not have to be MAIL_DOMAIN itself: sending from mg.uat.example.com with [email protected] as the sender is a common setup. The two do have to align, so the sending domain should be the domain of the sender or a subdomain of it, otherwise the receiver rejects the email. Set MAIL_SENDER_PREFIX_WHITE_LABEL_NAME when the name of the white label should be shown as the sender, in which case MAIL_SENDER only holds the address itself.

Mailgun can track whether an email is opened and whether its links are clicked, for which it replaces every link in the email by a link of its own. Because Harmoney sends registration, invitation and verification links, this tracking is disabled unless TRACKING is set.

Mailgun returns an identifier for every email it accepts, which is written to the logging events so a sent email can be found back in the delivery logging of Mailgun afterwards. This identifier is the reason the API is used instead of the SMTP server of Mailgun, which returns nothing.

⚙️ Configuration​

Implementation class​

MailgunEmailProvider

Settings​

Settings Configuration