dsn=5.6.0, stat=Data format error when forwarding e-mail

Solution 1:

Many others have solved this by fixing the "localhost" entry in /etc/hosts and/or setting up appropriate DNS entries. We did that, and it didn't fix our problem.

We finally noticed this: ctladdr=exmpl For mail which was correctly delivered, those log entries showed that as a full email address, e.g. ctladdr=<[email protected]> What was missing was this important entry in virtusertable:

[email protected] exmpl

I don't claim to fully understand this (this counts as my question!) because to me it looks like a "backwards" use of virtusertable. However, mail forwarded as above is now working!

May  6 21:06:40 bogus sendmail[1482]: r4726ejj001480: to=<[email protected]>, ctladdr=<[email protected]> (504/504), delay=00:00:00, xdelay=00:00:00, mailer=local, pri=62862, dsn=2.0.0, stat=Sent

Solution 2:

It is usually clearer what the problem is if you telnet to the MX server on port 25 and initiate a manual SMTP conversation.

In the example above where ctladdr=exmpl, if you entered this as the MAIL FROM, the MX server would have told you that the domain does not exist and that's why it can't accept your mail. I've had the problem where somedomain.com is defined in DNS and used for web traffic, but Apache tries to send mail as [email protected], and doing a manual SMTP conversation will reveal that the MX server can't findwww.somedomain.com.

The solution then is to add an A or CNAME record for this subdomain.