Web Hosting Talk







View Full Version : Error when sending message to AOL addresses


archangel777
03-17-2002, 01:16 PM
Hi.. I keep getting an error that comes back bounced to my root mail account whenever I try to send messages via a Form Mail (CGI script) on my website. This doesn't, however, happen when I use the Eudora or Outlook Express mail client to send messages to AOL addresses. It only happens on email sent through CGI forms.

This is the error I keep on getting:



"Hi. This is the qmail-send program at host.myhost.com. I'm afraid I wasn't able to deliver your message to the following addresses.

This is a permanent error; I've given up. Sorry it didn't work out.

<myaolname@aol.com>:
Connected to 205.188.156.249 but sender was rejected.
Remote host said: 550 REQUESTED ACTION NOT TAKEN: DNS FAILURE"



I'm using qmail. Any help would be very much appreciated.

bitserve
03-17-2002, 05:21 PM
What's in the following control files in qmail:

me
defaultdomain
defaulthost

Usually located at /var/qmail/control/?

If you are actually using FormMail, you may want to edit this line:

open(MAIL,"|$mailprog -t");

to

open(MAIL,"|$mailprog -t -f$Config{'email'}");

That way, it will actually be sent from the address that you specify in formmail, instead of from the default settings.

archangel777
03-17-2002, 05:47 PM
Thanks! The "-f$email" worked! Thanks a lot!

archangel777
05-28-2002, 12:43 AM
Anyone know a way to fix this in PHP? In Perl this works cuz you can control the path to the sendmail program and also add the "-f $email" option. However, I can't figure out a way to do this in PHP.

When using the "mail()" function and trying to send to AOL or netscape addresses, it never reaches the email box.

Anyone have any ideas?

mwatkins
05-28-2002, 12:58 AM
PHP:

function sendmail($from,$to,$subject,$message, $headers="") {
$pipe=popen("/usr/sbin/sendmail -t -i -r \"$from\" -f \"$from\" ","w");
if (!$pipe)
return false;
fputs($pipe,"Return-path: <$from>\n");
fputs($pipe,"From: $to\n");
fputs($pipe,"To: $to\n");
fputs($pipe,"Reply-To: $from\n");
fputs($pipe,"Subject: $subject\n");
fwrite($pipe,$message);
return !pclose($pipe);
}

archangel777
05-28-2002, 02:25 PM
I had to remove the quotation marks and backlashes for it to work... but other than that, it works perfectly. Thanks for the code!

mwatkins
05-28-2002, 02:36 PM
Ah good. I just realized I posted some code not from my production system, but its close enough. You should also note that $headers is never used in the code snippet I provided, if you need to add additional message headers insert another fputs in there... I typically add at least something like

X-Mailer: mysitename mailer version xxxx

Cheers
Mike