Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Ubuntu server, running sendmail (until this morning it was running postfix, but I moved to sendmail to eliminate the possibility of my postfix configuration tweaks being the cause of this issue). Up until a few weeks ago, this server was the sole mail server for my domain - and until I moved mail away from this box, email worked as expected, was delivered to the local users and was sent fine - but since moving it away, every time an email is sent through the MTA on this box it attempts to send it to the A record for my domain, rather than the MX records...which doesn't work very well as I use a CDN, and the CDN aren't hosting my mail funnily enough. From everywhere else to my domain is fine, and from that server sending to other domains is fine. If you perform a dig or an nslookup from the problem server the records appear correct, so after battling with this for nearly a week I'm stumped. Any help would be appreciated!

EDIT: DNS records for domain;

domain.com CNAME to server.domain.com
server.domain.com A to 1.1.1.1
MX mail.maildomain.com priority 10
MX mail1.maildomain.com priority 20

the server with issues is server.domain.com.

Thanks

share|improve this question
    
Was there some reason why you moved to sendmail from postfix? Your problem sounds like a configuration problem with sendmail. Did you read through the sendmail configuration documentation? sendmail.com/pdfs/open_source/installation_and_op_guide.pdf –  douggro May 8 '13 at 14:51
    
I moved because postfix was giving the exact same issue - I thought it could be an issue with my configuration as I'd done some tweaking back when I started using it as a mail server, so removed postfix and added sendmail with clean configuration in the hope it would eliminate a configuration issue. –  elliotberg May 8 '13 at 14:56
    
Please edit your post to include the DNS records for your domain (you can obfuscate domains/IP addresses in the listing). Are you running internal DNS service? After reviewing your question, it appears that your MUA's are not resolving the MTA's properly. Internally, sendmail or postfix will not care about DNS MX records - but MUA's connecting to either system need to resolve to the MTA designated in their SMTP Server settings. –  douggro May 8 '13 at 16:19
    
About the move to sendmail: I have yet to see a situation where sendmail is easier to handle than postfix (regarding configuration). –  guntbert May 8 '13 at 21:17
    
@douggro just added the DNS records I presume you need (there are tons on the domain, so I didn't add them all) - is there anything else you need? Also, for the record I far preferred postfix - I only switched in an attempt to fix this issue. Will gladly reinstall postfix when I get around to it, now knowing that it wasn't the cause of the issue. –  elliotberg May 9 '13 at 16:03

2 Answers 2

up vote 1 down vote accepted

Sendmail converts CNAME (DNS alias) to real name.
domain.com -> server.domain.com

Remove the CNAME OR add MX records for server.domain.com

share|improve this answer
    
Ah, that would make sense. If I removed the CNAME, but then added an explicit A record going to the same IP would that be fine do you think? I will try it, but wanted to ask as obviously it could be a while before DNS propagates! –  elliotberg May 10 '13 at 7:11
    
Using A instead of CNAME would be better from email perspective. You can make your sendmail ignore CNAME but there are so many other sendmails on the Internet. –  Andrzej A. Filip May 10 '13 at 7:18
    
OK - just changed that over then, let's see what happens! :) –  elliotberg May 10 '13 at 7:27
    
That fixed it. Also, switched back to postfix rather than sendmail because I actually know how to configure it ;) Thanks! –  elliotberg May 10 '13 at 10:05

If you are running multiple email servers - which your description sounds like you are - each server must have an A record. You can then add a CNAME record for each server to match the MX entries for your domain.

domain.com CNAME server.domain.com
server.domain.com A 1.1.1.1
server2.domain.com A 1.1.1.2
mail.domain.com CNAME server2.domain.com
mail1.domain.com CNAME server.domain.com
MX mail.domain.com 10
MX mail1.domain.com 20

You will then need to point your MUA's to mail.domain.com in their SMTP Server settings.

share|improve this answer
    
Not quite - MX mail.maildomain.com priority 10, MX mail1.maildomain.com priority 20. The mail is hosted elsewhere, not at my domain at all (although there are two mail servers as part of that set up). Both MX's are A records not CNAMEs as well, as I recalled someone telling me email wasn't always honoured when using a CNAME for an MX - don't ask me why though! –  elliotberg May 10 '13 at 7:10
    
Sorry, I missed the maildomain.com. I've had CNAMEs work resolving MX records, as long as the MX record is for the SOA of the domain and not further down the chain. So, if you have external mail servers, why are you running Postfix internally? Performing mail relays? –  douggro May 10 '13 at 15:27

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.