In this guide you’ll learn how to send Moesif behavioral emails with Mailgun.
Moesif behavioral emails is a feature that automatically sends emails to customers based on their API usage. This can be used to notify customers about technical issues, such as hitting rate limits, using deprecated APIs, or broken integrations. You can even use it to trigger business-related events such as when an item is shipped. If something can be mapped to an API call, then you can send an email from it.
In a companion article, we covered how to configure behavioral emails within your Moesif dashboard.
Mailgun is a managed email service. They offer an API to send emails to your users and host SMTP servers for you.
Setting up an Email Server
The first step in setting up the email server is getting the SMTP credentials from Mailgun.
For this, you have to log into the Mailgun dashboard.
The following screenshot illustrates how you navigate to the credentials.
These credentials have to be entered into the Moesif email server configuration form.
To navigate to the form, follow the steps in the next screenshot.
You can copy and paste the credentials from the Mailgun site to the Moesif site.
The Moesif form looks like this:
Track the end to end customer journey with MoesifLearn More
Testing the Setup
You can then send an example email via the freshly configured SMTP server with Moesif.
After you’ve configured the mailserver, you have to create a new email template:
For the new template, you have to fill out the required fields: template name, subject line and from email address.
Once that is done, click the “Test” button and enter the target email.
If everything worked correctly you’ll see the a new email in your inbox, also the Mailgun Dashboard will show that it has sent the email.
Setting up Moesif behavioral emails with Mailgun only takes a few minutes.
Using a service like Mailgun alleviates many common problems that might occur when sending email, such as validation issues and email being incorrectly identified as spam.
By combining Moesif’s behavioral email service with Mailgun, you’re able to keep your API consumers abreast of important issues.