How to send email with Mailgun
Knock integrates with Mailgun to send email notifications to your users.
In this guide you'll learn how to get started sending transactional email notifications with Mailgun through Knock. We also cover provider configuration and additional data you can pass through to Mailgun.
Features
- Attachments support
- Delivery tracking
- Bounce Support
- Link and open tracking
- Per environment configuration
- Sandbox mode
Getting started
You can create a new Mailgun channel in the dashboard under the Integrations > Channels section. From there, you'll need to configure the channel for each environment you have.
Provider configuration
Environment default settings
The following fields are optional and if set, will be applied to all email messages sent via this channel within the environment:
Additional data sent
Knock sends the following attributes along with your emails:
v:sender
: always set toknock.app
v:knock_message_id
: the ID of the message this email is associated withv:knock_recipient_id
: the Knock ID of the recipient this email is being sent too:tag
: the workflow key for the workflow being invoked
You can learn about the role of these Mailgun attributes in the Mailgun API documentation.
Recipient data requirements
In order to send an email notification you'll need a valid email
property set on your recipient.
Delivery tracking
Delivery tracking for Mailgun can result in the following status updates to your message:
- The message delivery is confirmed and Knock updates the message to
delivered
- The message was not delivered and Knock updates the message to
undelivered
- The message was not delivered due to bad recipient(s) and Knock updates the message to
bounced
Passing additional tags to Mailgun
It's possible to pass additional tags to Mailgun by setting the "JSON overrides" attribute in the channel configuration or at the message template level.
To pass one or more tags, you can set the o:tag
attribute to an array of tag names: