Thursday, June 11, 2009

Sendmail and "SMTP; 550 REQUESTED ACTION NOT TAKEN: DNS FAILURE" Error Involving "apache at localhost.localdomain"

I run a web forum, and for some of the user registration/notification emails I was getting email bounced back sent from my server being bounced back, notably from AOL.com. The "Returned mail: see transcript for details" emails always have the info:

----- Transcript of session follows -----
... while talking to mailin-04.mx.aol.com.:
>>> >>> MAIL From:
<<<>

Received-From-MTA: DNS; localhost.localdomain

Final-Recipient: RFC822; ************@aol.com
Action: failed
Status: 5.0.0
Diagnostic-Code: SMTP; 550 REQUESTED ACTION NOT TAKEN: DNS FAILURE

I thought I had configured sendmail on my Linux server hosting the web forum correctly, but apparently after some research I needed to do more.

I needed to create a file called "genericstable" under "/etc/mail", and place the following line in it:

apache user@my_domain.com

You would substitute "user@my_domain.com" with the user you want to show as the sender from your web forum script to show up as.

Then edit "/etc/mail/sendmail.mc" and add the following lines (before the MAILER lines):

FEATURE(masquerade_envelope)dnl
FEATURE(`genericstable')dnl
GENERICS_DOMAIN(`localhost.localdomain')dnl

Then do a:

m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf

to compile the sendmail configuration file, restart sendmail (I do a /etc/rc.d/init.d/sendmail restart), and voila- there shouldn't be any more rejected mail from your server with the "550 DNS Failure apache@localhost.localdomain" sort. Hope this helps!

0 comments: