Newsletters: Mailgun API
1. What is MailGun?
MailGun is an SMTP email relay service which allows you to send transactional emails through their API or via SMTP.
Included is tracking, bouncing, receiving of incoming emails and many other features.
2. Setup MailGun
2.1. Add and Verify Domain
Let’s assume that you haven’t yet added and verified a domain in MailGun to use for sending. If you have, of course you can skip this step.
Then click the “Add New Domain” button to add your domain. The domain you’ll be adding is your own domain that you’ll be sending from (the “From Address” setting in the Newsletter plugin) and also most likely the same domain that your WordPress installation is running.
So add your domain eg. domain.com and click “Add Domain” to finish.
Next you’ll see a page which gives you several steps/instructions to follow. These steps will ask you to add several DNS records on your domain or hosting in order to verify the domain, apply DKIM (Domain Keys Identified Mail) and then also to do tracking of links in emails on your own domain name.
Follow the instructions but skip step 4 unless you actually want to use MailGun to receive emails. In most cases you’ll want to skip this because you only want to use MailGun for sending emails, not receiving emails.
You’ll see that MailGun says “Unverified” and gives the following message:
If you’ve added the DNS records correctly, scroll down a bit and click the “Check DNS Records Now” button.
That’s it, you’re done and your domain should now be verified.
3.) Setup Mailgun in the Newsletter Plugin
Configure the MailGun API under Newsletter>Configuration-General Mail Settings
3.1) Select API as Mail Type
3.2) Select MailGun as API Service
3.3.) Mailgun API Key – You will find this API key in your MailGun dashboard.
Login to Mailgun.
Click Domains and select your domain that you want to use. You will see information about this domain. Copy and paste the API Key in the newsletter settings.
3.4.) Enter your verified MailGun domain
3.5.) Select appropriate MailGun Region
3.6.) Validate MailGun email by ticking the “Use MailGun email validation API to validate email address” option. Please notice this feature will work only with MailGun paid accounts and NOT free accounts.
3.7.) Get your Public API Key in your MailGun dashboard.
3.8) MailGun Actions- You can Verify your API key with the “Verify API Key” action
If you want to view your verified domains click the “See Domains” action.
You can add a new domain by clicking the “Add Domain” action, it will add your MailGun Domain (step 3.4) to your MailGun account.
Test account settings, all should be in order and you will be able to send emails through the MailGun API.