Mailgun
Setup mailgun for email sending
- Set up Mailgun account
- Verify and setup payment info
Send->Sending->Domains->Add new domain- Pick a subdomain value for the purpose of this email sender
- mg.yoursite.com booking.yoursite.com etc
- We'll use
bookingfor these instructions
Advanced settings (DKIM) -> 2048
Click
Add DomainOpen up domain registrar (namecheap, etc.)
Domain List->MANAGE->Advanced DNS
Add 3 DNS HOST records
Under
HOST RECORDS, clickADD NEW RECORDClick the
A Recorddropdown and selectTXT RecordFor
Hostwrite in your subdomain i.e.bookingFor
Value, paste insubdomaini.e.bookingNote: The above step should cover this if you write in theHostmanually. With Namecheap for the suggestedHostvalue from Mailgun, we need to remove the tail end.yourdomain, leaving just the first part with the subdomain.Repeat above steps to add one more
TXT Recordwhere theHostis just your subdomain i.e.bookingFor
Value, paste in the value from Mailgun
moved this above * optional step here for better DKIM security: Click Regenerate DKIM, select 2048, add, and copy that new
Valueto paste in- Add one more record in this section and select
CNAME Record - For
Hostwrite inemail.subdomaini.e.email.booking - Click
SAVE ALL CHANGES
Add 2 MAIL SETTINGS records
- Next to
MAIL SETTINGSclick the dropdown where the default isEmail Forwardingand selectCustom MX, or if it's already been set up before you can clickADD NEW RECORD - For
Host, write in your subdomain i.e.booking, removing the.yourdomainlike above - For
Value, paste/write inmxa.mailgun.org. - For
Prioritywrite in10 - Click
SAVE ALL CHANGESand add one more new MX Record by clickingADD NEW RECORD, nearly identical to the other - For
Host, write in the same subdomain value - For
Value, paste/write inmxb.mailgun.org.(different) - For
Priority, write in the the same10 - Click
SAVE ALL CHANGES
- Next to
Go back to Mailgun and click
Verify Records(?), and if successful it will clear the page. Note: If not successful immediately it may take 5+ minutes for the DNS records to propagate. If not resolved after 5m, go back to Namecheap and for the 5 new records, change the TTL dropdown fromAutomaticto5 min, clickSAVE ALL CHANGESfor both sections. Then try to verify records after another 5m Congrats, you've connected Mailgun to send from your domain. You can use Mailgun via SMTP (email credentials) or an API key, depending on your application. Follow Mailgun Docs on this or follow the next instructions.
Mailgun SMTP Records
- Click
Send->Sending->Domain settings - Click the tab for
SMTP credentials - Click
Add new SMTP user - Under
Login, write in a name for the email account- i.e. for the "booking" example, could do
calto get cal@booking.yoursite.com
- i.e. for the "booking" example, could do
- Leave Password creation set to Automatic
- Click
Create - Click
Copyon the bottom-right pop-up - Paste this in a password manager or somewhere safe with the full email above as the username
- Save these values in the same location, you will need later
* HOST is
smtp.mailgun.org* PORT we'll use587(Alt. 25, or 465)
These 4 values are needed for any application to send emails via SMTP protocol.
Mailgun Setup Forwarding Address
Since the credentials we created are only for outbound sending, we need to configure a forwarding address where any reply emails will be sent.
- Click
Send->Receiving - Click
Create Route - Change the Expression Type dropdown to
Match Recipient - Under Recipient, fill in the user from the SMTP setup
name@sub.website.com - Toggle on
Forwardand fill in your email address you can receive mail at - Optionally, add a Description
- Click
Create routeto save the forwarding settings