Jump to content

How can I send email to AOL via PHP?


SForsgren

Recommended Posts

I have code that sends email to customers via PHP mail() but the mail never gets to AOL customers.  I looked at the headers of two different emails - one sent from the same hosting service/domain with SquirrelMail and the other via PHP.  I see some differences that I am sure are related to why AOL is blocking the emails but I cannot seem to get the Return-Path to override from the PHP - I tried.

 

Works:

 

From: [email protected]

Date: March 3, 2007 8:22:23 AM PST

To: [email protected]

Subject: from squirrel

Return-Path: <[email protected]>

X-Original-To: [email protected]

Delivered-To: [email protected]

Received: from svr73.ehostpros.com (svr73.ehostpros.com [67.15.58.76]) by xyz.com (Postfix) with ESMTP id 67AFF1EB0421 for <[email protected]>; Sat,  3 Mar 2007 08:22:27 -0800 (PST)

Received: from healt73 by svr73.ehostpros.com with local (Exim 4.52) id 1HNX03-0005PD-Ki for [email protected]; Sat, 03 Mar 2007 08:22:23 -0800

Received: from 69.181.128.1 ([69.181.128.1]) (SquirrelMail authenticated user [email protected]) by svr73.ehostpros.com with HTTP; Sat, 3 Mar 2007 08:22:23 -0800 (PST)

Message-Id: <[email protected]>

User-Agent: SquirrelMail/1.4.9a

Mime-Version: 1.0

Content-Type: text/plain;charset=iso-8859-1

Content-Transfer-Encoding: 8bit

X-Priority: 3 (Normal)

Importance: Normal

X-Antiabuse: This header was added to track abuse, please include it with any abuse report

X-Antiabuse: Primary Hostname - svr73.ehostpros.com

X-Antiabuse: Original Domain - xyz.com

X-Antiabuse: Originator/Caller UID/GID - [32451 504] / [47 12]

X-Antiabuse: Sender Address Domain - abc.net

X-Source: /usr/local/cpanel/3rdparty/bin/php

X-Source-Args: /usr/local/cpanel/3rdparty/bin/php /usr/local/cpanel/base/3rdparty/squirrelmail/src/compose.php

X-Source-Dir: :/base/3rdparty/squirrelmail/src

 

The above works fine.  The below does not:

 

From: [email protected]

Date: March 3, 2007 8:19:19 AM PST

To: [email protected]

Subject: Rewards Program Confirmation

Reply-To: [email protected]

Return-Path: <[email protected]>

X-Original-To: [email protected]

Delivered-To: [email protected]

Received: from svr73.ehostpros.com (svr73.ehostpros.com [67.15.58.76]) by xyz.com (Postfix) with ESMTP id 47D441EB03AC for <[email protected]>; Sat,  3 Mar 2007 08:19:23 -0800 (PST)

Received: from nobody by svr73.ehostpros.com with local (Exim 4.52) id 1HNWx5-0005IU-IK for [email protected]; Sat, 03 Mar 2007 08:19:19 -0800

Message-Id: <[email protected]>

X-Antiabuse: This header was added to track abuse, please include it with any abuse report

X-Antiabuse: Primary Hostname - svr73.ehostpros.com

X-Antiabuse: Original Domain - xyz.com

X-Antiabuse: Originator/Caller UID/GID - [99 504] / [47 12]

X-Antiabuse: Sender Address Domain - svr73.ehostpros.com

X-Source-Args: /usr/local/apache/bin/httpd -DSSL

X-Source-Dir: abc.net:/public_html

 

I have read that AOL will block "nobody" emails as above.  Is there another way I can send mail from PHP using POP or some other mechanism that will allow me to send emails to my customers on AOL?  I tried talking with EHostPros about this but they were of no help and had no understanding of the issue.

 

Thanks SO much for any thoughts. 

 

Be well,

Scott

Link to comment
https://forums.phpfreaks.com/topic/41135-how-can-i-send-email-to-aol-via-php/
Share on other sites

if you are using shared hosting on a UNIX/Linux machine that uses sendmail or a sendmail clone like exim, you can use the fifth parameter of the mail() function to set the "Return-Path" header. In the OP's case the fifth parameter would be set to "-f [email protected]".

 

Ken

I did it like this:

 

$custTo = $_REQUEST['email'] ;

$custFrom = "[email protected]";

$custSubject = "Program Confirmation";

 

// $custHeaders = "MIME-Version: 1.0\r\n".

//  "Content-type: text/html; charset=iso-8859-1\r\n".

// "From: " . $custFrom .  "\r\n" .  'Reply-To: '  . $custFrom . "\r\n" ;

 

$custHeaders = "Return-Path: " . $custFrom . "\r\n" . "From: " . $custFrom .  "\r\n" .  'Reply-To: '  . $custFrom . "\r\n" ;

 

$custMessage = "

<html>

<body>

<b>html message</b><br>

<font color=\"red\">here</font>

<img src=\"http://static.php.net/www.php.net/images/php.gif\"

border=\"0\" alt=\"\">

</body>

</html>

";

 

mail($custTo, $custSubject, $custMessage, $custHeaders);

 

Please let me know if this is incorrect.  Thanks much!

That method does not work, as you found out. The only method that I know of to get the Return-Path header changed is to use the fifth parameter to the mail() function. Here's your code modified to do so:

<?php
$custTo = $_REQUEST['email'] ;
$custFrom = "[email protected]";
$custSubject = "Program Confirmation";

// $custHeaders = "MIME-Version: 1.0\r\n".
//  "Content-type: text/html; charset=iso-8859-1\r\n".
//   "From: " . $custFrom .  "\r\n" .  'Reply-To: '  . $custFrom . "\r\n" ;

$rp = '-f ' . $custFrom; 
$custHeaders = "From: " . $custFrom .  "\r\n" .  'Reply-To: '  . $custFrom . "\r\n" ;

$custMessage = "
<html>
<body>
html message

<font color=\"red\">here</font>
<img src=\"http://static.php.net/www.php.net/images/php.gif\"
border=\"0\" alt=\"\">
</body>
</html>
";

mail($custTo, $custSubject, $custMessage, $custHeaders, $rp);
?>

 

Ken

and I thought this might work.  I was excited... :)  What I get back is:

 

Warning: mail(): SAFE MODE Restriction in effect. The fifth parameter is disabled in SAFE MODE. in /home/healt73/public_html/mailTest2.php on line 25

 

This hosting company is really impossible to work with.  They support not one way that I can get an email sent from PHP that will get by AOLs filtering due to the way the hosting service has setup their servers. 

 

Any other ideas would be welcomed!  Thanks much for the ideas so far. 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.