Deliver email notifications with your Mailgun account
To have Mailgun configured for your MagicBell project, follow these steps:
- Sign up for Mailgun and obtain an API key
- Send us your API key and sending domain
- Verify the email channel in MagicBell is enabled
You can also set the name and email of the sender of all email notifications.
Once your account is set up, MagicBell will automatically deliver email notifications through your Mailgun account, no additional work is needed.
Sending emails with additional or unique content
Our create notifications endpoint
allows you to customize the content sent to Postmark by setting
notification.overrides
.
The notification.overrides
parameter accepts all of the Mailgun's Messages API
body parameters.
Below is an example of a tagged message with custom headers.
json{
"notification": {
"title": "We're processing your order",
"content": "<p>Thank you for your order. We'll notify you when these items are ready.</p>",
"recipients": [
{
"email": "dan@example.com"
}
],
"overrides": {
"providers": {
"mailgun": {
"o:tag": "onboarding",
"h:X-Original-To": "devs@example.com"
}
}
}
}
}
Using Mailgun email templates
MagicBell can deliver email notifications using Mailgun email templates.
Create a template in Mailgun, and grab its ID. Then create a notification with the template
attribute set in
notification.overrides.providers.mailgun
. MagicBell will use custom_attributes
to fill in your template.
json{
"notification": {
"title": "We're processing your order",
"content": "<p>Thank you for your order. We'll notify you when these items are ready.</p>",
"recipients": [
{
"email": "dan@example.com"
}
],
"custom_attributes": {
"name": "Dan",
"company_name": "Example Inc"
},
"overrides": {
"providers": {
"mailgun": {
"template": "incident_report"
}
}
}
}
}