Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I am using Amazon Route 53 and have a correctly functioning A record pointing to an EC2 instance at mydomain.com.au with a Django stack running.

My problem is, I tried to setup a Postfix mailserver but I could not receive mail, so I figured my problem is with the MX record (since local mail worked).

This is what I have got for my MX record and just wanted to confirm if it is correct, or if it's nonsense:

(Settings as per AWS interface)
Name: left it blank (mydomain.com.au)
Value: 10 titan.mydomain.com.au

I have used "titan" because it's the hostname of my server - should I use "mail" instead? I keep seeing this on the web but can't find an explanation of if it's arbitrary.

I want the e-mails to work such that user@mydomain.com.au gets delivered to the server.

I have looked at this question and this one too, but didn't find an answer in them.

share|improve this question

2 Answers 2

I'm afraid I couldn't help you with the complications of setting up a Postfix mailserver, however with regards to your questions about the DNS records:

  • The MX record you have created looks fine, provided that you have checked that (a) you have no other MX records with a priority less than 10, and (b) you have definately also got an A record setup for titan.mydomain.com.au.

  • MX records at the top domain level (i.e. not for subdomains) are first checked for where to deliver mail to for email addresses ending in @mydomain.com.au, and if no MX records are present sometimes a mailserver will check to see if there is a working mailserver behind the A record that will receive messages (note: not all mailservers will try this).

  • Since MX records are specified as domains and not IP addresses, they always rely upon an A record existing for the domain specified, and so often this is where people would create a mail.mydomain.com.au A record behind the mydomain.com.au MX record since although even if both initially may point to the same IP address, this means that should any circumstances change the IP address for the mailserver or the IP address for the website could be changed independently without affecting the other. It's also relatively common for larger websites to have multiple A records for load balancing/resilience however each webserver would not necessarily provide any mail services and so this separation can be considered best practice. If the same A record is shared for both the website and the mailserver (e.g. by using an MX record of just mydomain.com.au) then often downtime to one service or the other results when any changes are made.

  • If you had setup an MX record for mail.mydomain.com.au for example then this would be checked only for identifying the mailserver to receive messages sent to youralias@mail.mydomain.com.au, which provides a capability to have different mailservers behind different subdomains.

To test if your email server is working correctly I would recommend you try the MX Lookup and follow-on Mailserver Test tools at mxtoolbox.com.

share|improve this answer
    
Thank you for the explanation. That helped me set up the proper records in AWS and I am successfully receiving e-mails from external internet servers :)! I don't have enough rep to upvote –  softwaregeek Jul 7 at 12:56
    
Sorry, a question about one thing, can a CNAME be used in place of an A record for this case? –  softwaregeek Jul 7 at 12:58
    
No I'm afraid not, your MX record must point to an A record to work correctly. From a DNS lookup you can find the IP address from behind the domain you wanted to use for a CNAME record, and then just specify that IP address for your A record. This is another reason why a subdomain such as mail.mydomain.com.au is used for the mailserver A record since this allows for the website to use a CNAME record instead if required. One other note for reference, while AWS does not require it if you were using a different DNS solution you may need to enter an @ symbol to represent the parent domain name. –  richhallstoke Jul 7 at 16:29

I generally set up a sub-domain name, though it is not necessary. The sub-domain name does not matter. I use mail, but titan is perfectly fine. You want to either set up your sub-domain name using either a CNAME pointing to mydomain.com.au or as an A record just like mydomain.com.au. Either way you chose, it does not matter. Next you would set up a MX record to point to titan.mydomain.com.au just like you probably have already. The numeric value does not matter when you have only one MX record.

Now, before we get too far, you will need an SMTP gateway. I am not sure about your install, but for most Postfix users, they use Dovecot which can handle POP and SMTP. It may be that one is already installed. It may not be Dovecot. You may need to check.

I mentioned this because if it appears that your DNS records are set right, then that would be the next thing I would check for and configure. You can test this by opening up a telnet session to port 25. You should see an MTA announcement. Test this using both the titan.mydomain.com.au and then the IP address with a little time in between. If you do not see the announcement, test the domain name resolution by pinging your server using titan.mydomain.com.au. If the ping works, then you have a gateway issue and that is another question. ;-)

share|improve this answer
    
thanks for the response, once I get home I will login to my AWS and run postfix and see if it all works. I will let you know how it goes :) BTW, yes, this is a multistep process (with Dovecot etc) and I intend to follow a tutorial to get all that setup too, but I need the basics to work first lol –  softwaregeek Jul 7 at 4:29
    
I have to admit, I was a web host for many years and consulted to all the top teleco's all over the world providing Internet services expertise and I still have trouble configuring Postfix and all the associated stuff sometimes. It is not as easy as it appears to be. Pay attention to the documentation. You will get it. If not, we are here for you! –  closetnoc Jul 7 at 4:34
    
Thanks for all the help, it's all working :) now onto the next challenge... –  softwaregeek Jul 7 at 12:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.