Mailgun
Profile Requirements
To deliver a message to a recipient over Mailgun, Courier must be provided the recipient's email address. This value should be included in the recipient profile as email
.
// Recipient Profile
{
"email": "example@example.com"
}
Override
You can use a provider override to replace what we send to Mailgun's Messages API. For example, you can use Mailgun's Tagging with your request:
{
"event": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"recipient": "abc123",
"profile": {
"email": "example@example.com"
},
"override": {
"mailgun": {
"body": {
"o:tag": "notifications"
},
"config": {
"apiKey": "<your API Key>",
"domain": "<domain>",
"host": "<host>"
}
}
}
}
Everything inside of override.mailgun
will replace what we send to Mailgun's Messages API. You can see all the available options by visiting Mailgun API docs.
Sending Attachments
To include an attachment in the email, you can use the following override:
{
"event": "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
"recipient": "abc123",
"profile": {
"email": "example@example.com"
},
"data": {
"hello": "world"
},
"override": {
"mailgun": {
"attachments": [
{
"filename": "billing.pdf",
"contentType": "application/pdf",
"data": "Q29uZ3JhdHVsYXRpb25zLCB5b3UgY2FuIGJhc2U2NCBkZWNvZGUh"
}
]
}
}
}