Sometimes instead of sending to John.Doe@example.com our sendmail and web app sends to John.Doe@local.machine.com. And of course the mail is undeliverable because user John.Doe does not exist on our local machine.
Subject: Undeliverable: Your account has been created
Your message did not reach some or all of the intended recipients.
Subject: Your account has been created
Sent: 10/6/2011 9:24 AM
The following recipient(s) cannot be reached:
John.Doe@local.machine.com on 10/6/2011 9:24 AM
The e-mail account does not exist at the organization this message was sent to. Check the e-mail address, or contact the recipient directly to find out the correct address.
< local.machine.com #5.1.1 SMTP; 550 5.1.1 <John.Doe@local.machine.com>... User unknown>
The sendmail log shows
Oct 6 09:24:16 MACHINENAME sendmail[11689]: p96DOG1G011689: <John.Doe@local.machine.com>... User unknown
Sendmail is set to relay to an Exchange server and it seems to be mailing okay internally and to gmail. It looks like this problem: Linux Sendmail server misdelivers mail to my own domain? and running dig MX example.com seems to return a good record. Any ideas?