Configure MX record when DNS are pointing to a Heroku application

domain-name-systememailherokumx-record

SEND EMAILS

I want to use my_domain.com addresses, and overcome the 5 mails/minute limitation of Gandi, my domain provider. My application is hosted on Heroku. For this, I am considering 2 options:

  • Use the Sendgrid add-on from Heroku to send e-mails
  • Using Gmail with alias info@my_domain.com, which is possible only if info@my_domain.com can receive emails (to confirm I own this address)

–> which option would you recommand ?

RECEIVE EMAILS

  • I want to be able to receive emails at the address info@my_domain.com

FIRST

a) I overrid the Gandi's DNS servers settings, to replace them by Zerigo's DNS. This allows me to redirect all DNS requests made to my_domain.com to my application hosted on Heroku. So, instead of DNS1 : a.ns.gandi.net, it is now: DNS1: a.ns.zerigo.net …

b) I added inside Zerigo: host=www.my_domain.com data=proxi.heroku.com

==> it works fine for the web (my_domain requests are redirected to my heroku app) but I don't receive incoming emails in my Gandi mailbox, as it was the case before changing the DNS settings.


SECOND

What I should do, I guess, is to add a MX record into Zerigo, so that incoming emails are properly handled, as described here: https://www.zerigo.com/docs/managed-dns/creating_your_first_domain

So, I added a MX record and an additional record, as mentioned in the website above, and I tried two options, none of them works:

a) MX record: HOST=my_domain.com, DATA=mail.my_domain.com + CNAME record: HOST=mail.my_domain.com, DATA=proxi.heroku.com

b) MX record: HOST=my_domain.com, DATA=mail.my_domain.com + CNAME record: HOST=mail.my_domain.com, DATA=mail.gandi.net

So, I guessed I'm mixing up things, and I'm really confused … As you may understand, I'm a bit of a newbie in this kind of stuff, so any help/clarification would be appreciated !

Best Answer

Or you could just use an external mail provider like Google.

Create a Goolge Apps-account. After that, configure your application to use the Gmail-servers for sending/receiving mail.

Incoming Mail (IMAP) Server - requires SSL: imap.gmail.com
Use SSL: Yes
Port: 993

Outgoing Mail (SMTP) Server - requires TLS: smtp.gmail.com (use authentication)
Use Authentication: Yes
Use STARTTLS: Yes (some clients call this SSL)
Port: 465 or 587

Account Name:   your full email address (username@your_domain.com)
Email Address:  your full Gmail address (username@your_domain.com)
Password:   your Gmail password

At Gandi, you should edit your MX records to the following:

Priority    Mail server
1           ASPMX.L.GOOGLE.COM
5           ALT1.ASPMX.L.GOOGLE.COM
5           ALT2.ASPMX.L.GOOGLE.COM
10          ASPMX2.GOOGLEMAIL.COM
10          ASPMX3.GOOGLEMAIL.COM

Or, Gandi expert mode:

@ 28800 IN MX 1 ASPMX.L.GOOGLE.COM.
@ 28800 IN MX 3 ALT2.ASPMX.L.GOOGLE.COM.
@ 28800 IN MX 5 ASPMX2.GOOGLEMAIL.COM.
@ 28800 IN MX 5 ASPMX4.GOOGLEMAIL.COM.
@ 28800 IN MX 5 ASPMX5.GOOGLEMAIL.COM.

If you don't use Gandi DNS but Zerigo DNS, you should make your configuration like this:

enter image description here enter image description here