Seperate web/mail server, mailserver won't receive emails

Sam Holguin asked:

I have a basic set up:

  • VPS
  • Mailserver
  • Domain Management

This is my first experience setting up both a VPS and a separate mail server.

My mail server won’t receive emails.

DNS

A   mail.samholguin.co.uk.  79.170.40.147       3600     
A   samholguin.co.uk.       209.222.30.215      3600     
MX  mail.samholguin.co.uk.  mail.samholguin.co.uk.

209.222.30.215 = VPS

79.170.40.147 = Heart Internet

The issue appears to be my VPS is rejecting the emails, they don’t even hit the mail server.

Are my records in order?

EDIT

Error message: Technical details of permanent failure:
Google tried to deliver your message, but it was rejected by the server for the recipient domain samholguin.co.uk by samholguin.co.uk. [209.222.30.215].

My answer:


Your domain hasn’t actually got an MX record.

$ host -t mx samholguin.co.uk
samholguin.co.uk has no MX record

Without an MX record, mailers will fall back to trying to deliver to an address for the naked domain. That address is:

$ host samholguin.co.uk
samholguin.co.uk has address 209.222.30.215

An MX record for a subdomain would only apply if you were trying to deliver mail to the subdomain. So the MX record you posted is wrong, redundant and ignored anyway.

You just need to create an MX record for your naked domain which points to the hostname of the mail server. For example:

samholguin.co.uk. IN MX 10 mail.samholguin.co.uk.

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.