Receiving Email at Mailgun for your Domain

  • Setup Mail Exchanger (MX) Records in DNS

    The last step in our guide is going to be to configure Mailgun to forward email it receives for your domain over to an existing email address (i.e. a Gmail, Yahoo, Hotmail, AOL, whatever address - just an existing email address that you already receive email at).
  • This guide does not cover setting up your own POP3 / IMAP server for receiving email on your server - if you need to set that up you should be able to find plenty of guides using Google.
  • Our first step is to setup Mail Exchanger records - commonly known as "MX Records":

    http://en.wikipedia.org/wiki/MX_Records

    An MX record tells a sending email server that Mailgun is accepting email for your domain so it gets routed appropriately.

    To setup our MX records, make sure you are logged into DigitalOcean, and go to the DNS records listing for your new domain (DNS -> click on the magnifying glass to the right of your domain).

    Next, click on the big blue "Add Record" button in the upper right corner, and choose "MX" as the record type:
  • You need to do this 2 TIMES - once for "mxa" and once for "mxb"!
  • For the hostname you want to enter:

    mxa.mailgun.org. - again don't forget that trailing period, as it is required.

    For the Priority, set it to "10". Then click the green Create button to create the record.

    Now we have to create another record exactly the same as this one, but this time it is for the "mxb" host:

    mxb.mailgun.org.

    Set the priority to 10 as well and create that record.

    That's it - your MX records are now setup for your domain.
  • Setting up email routing in Mailgun

    Our next step is to setup "routing" of incoming email and forwarding it over to an existing email address you are already using.

    This is one of the coolest, most powerful features that Mailgun offers, and is what makes their system really awesome. You can "route" email to not only other email address, but you can have email (already parsed) POSTED to a URL. This is how Jamroom's Support Center works!

    So log back into your Mailgun Control Panel and click on the "Routes" tab:
  • Once the Routes page loads, click on the "Create Route" button:
  • You will then see the "Create new Route" screen:
  • To setup our new "route", do the following:

    - in the Priority field, set it to "1"

    - in the Filter Expression field, start typing "match_recipient" and you will see it sees what you are trying to type and has a drop down match - click on it to add the new route rule. Inside the quotes, you want to enter the email address you want to receive email at - i.e. "you@yourdomain.com" - of course change "yourdomain.com" to whatever. For me it is "brian@jamroom.net".

    - next, in the Actions field start typing the word "forward" and you will see it once again sees what you are typing and suggests the "forward()" action - select that with your mouse, and in between the quotes enter your existing email address you are already receiving email at.

    - lastly, give it a description if you would like.

    Then click on the black "Save" button at the bottom and your new route will be created. Now when someone sends email to "you@yourdomain.com" it will be forwarded over to your existing email.

    You are all set! You can enter as many routes as you want for different email address (maybe you want to have a "support" email address, or a "sales" email address, etc.).

Tags