Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Ok, so I've got a box named websrv1.mydomain.com. It's a web server running ubuntu, apache2, sendmail, etc.

My email is outsourced to a third party. So in my DNS I've got MX set to mx.thirdparty.net. I've no reason to accept incoming mail on my web server, every email should be sent to the third party. This works correctly accept with sending mail from the webserver (aka via cron or console).

So from my web server, if I send an email to me@mydomain.com, it just disappears. No errors, nothing in dead.letter, nothing. I can send to any other address with no issues. If I send to me@websrv1.mydomain.com it's delivered locally which is fine.

1) Doing an nslookup shows the mx record is correct.
2) Running /mx mydomain.com from sendmail -bt returns the correct result.
3) Running sendmail -bv me@mydomain.com returns:

 sudo sendmail -bv me@mydomain.com
 me@mydomain.com... deliverable: mailer esmtp, host mydomain.com., user me@mydomain.com

4) Running 3,0 me@mydomain.com, returns:

    3,0 me@mydomain.com
    canonify           input: me @ mydomain . com
    Canonify2          input: me 
    Canonify2        returns: me 
    canonify         returns: me 
    parse              input: me 
    Parse0             input: me 
    Parse0           returns: me 
    Parse1             input: me 
    MailerToTriple     input:  me 
    MailerToTriple   returns: me 
    Parse1           returns: $# esmtp $@ mydomain . com . $: me 
    parse            returns: $# esmtp $@ mydomain . com . $: me 

So I'm at a loss. Sendmail seems to see the mx record, but it's not using it.

share|improve this question
    
Also see my question at stackoverflow.com/questions/322659/… –  Jim Nelson Feb 7 '12 at 23:39

5 Answers 5

Check to ensure that sendmail is not configured to handle the local domain. Strange vanishing acts can occur if it tries to handle the email locally, but it bounces, but the bounce also bounces.

Must you use sendmail? I've replaced everything with Postfix. It's much easier to handle, IMHO.

share|improve this answer

If you have a smarthost line in your sendmail.mc, is it in brackets?

define(SMART_HOST',[smtp.thirdparty.net]')dnl

that will cause sendmail to skip MX record lookup and use the A record directly. That's probably what you want in this case.

share|improve this answer

Have you looked at your maillog logfile? There might be some information there that can help you troubleshoot the problem.

Another test you can do is to send email as a user on that machine to an account at your @domain.com and then see whether it is actually being deilvered by sendmail by looking at your maillog logfile.

I do not have an ubuntu server I can access but the maillog file should be /var/log/maillog

share|improve this answer
    
It's probably /var/log/mail.log (with a dot) - and mail.warn and mail.err –  Dennis Williamson Dec 30 '09 at 17:31
    
...but that may just be postfix. –  Dennis Williamson Dec 30 '09 at 17:39
    
Ok, thanks for the notes on the log file. Using that I was able to confirm the emails were being sent; the third party was blocking them because of a Spamhause.org PBL listing. All fixed up now. –  CreativeNotice Dec 30 '09 at 20:49

What I did to disable local delivery. I'll be using the example.com domain.

Requirements:

  • example.com A entry pointing to IP address assigned to one of the eth interfaces.
  • /etc/hosts defining example.com assigned to the very same IP address as above
  • example.com MX records pointing to Google servers (ASPMX.L.GOOGLE.COM, etc)
  • default sendmail installation (mine was on Ubuntu)

Steps:

vim /etc/mail/sendmail.mc

at the end:

define(`MAIL_HUB', `example.com.')dnl
define(`LOCAL_RELAY', `example.com.')dnl

and then:

sendmailconfig
service sendmail restart

testing:

echo -e "To: user@example.com\nSubject: Test\nTest\n" | sendmail -bm -t -v
echo -e "To: user\nSubject: Test\nTest\n" | sendmail -bm -t -v

You should see it connecting to the google server and then you should see your mail being delivered to your Google inbox.

share|improve this answer

If you're using postfix:

  1. Check your configuration: postconf | grep "^\(mydestination\|mydomain\|myhostname\)"
  2. If your mydestination includes the domain on which you've setup Google Apps:
  3. sudo vi /etc/postfix/main.cf and check the configuration, then save.
  4. Check configuration (like step 1) and restart postfix sudo service postfix restart (optional?)
share|improve this answer

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.