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: auto-response@abc.net

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

To: scott@xyz.com

Subject: from squirrel

Return-Path: <auto-response@abc.net>

X-Original-To: scott@xyz.com

Delivered-To: sforsgren@xyz.com

Received: from svr73.ehostpros.com (svr73.ehostpros.com [67.15.58.76]) by xyz.com (Postfix) with ESMTP id 67AFF1EB0421 for <scott@xyz.com>; 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 scott@xyz.com; Sat, 03 Mar 2007 08:22:23 -0800

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

Message-Id: <1773.69.181.128.1.1172938943.squirrel@svr73.ehostpros.com>

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: auto-response@abc.net

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

To: Scott@xyz.com

Subject: Rewards Program Confirmation

Reply-To: auto-response@abc.net

Return-Path: <nobody@svr73.ehostpros.com>

X-Original-To: Scott@xyz.com

Delivered-To: scott@xyz.com

Received: from svr73.ehostpros.com (svr73.ehostpros.com [67.15.58.76]) by xyz.com (Postfix) with ESMTP id 47D441EB03AC for <Scott@xyz.com>; 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 Scott@xyz.com; Sat, 03 Mar 2007 08:19:19 -0800

Message-Id: <E1HNWx5-0005IU-IK@svr73.ehostpros.com>

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
Share on other sites

may want to make sure these 3 lines are in your headers part of your mail function with php

 

Mime-Version: 1.0

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

Content-Transfer-Encoding: 8bit

 

Ray

Link to comment
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 auto-response@abc.net".

 

Ken

Link to comment
Share on other sites

I did it like this:

 

$custTo = $_REQUEST['email'] ;

$custFrom = "auto-response@x.net";

$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!

Link to comment
Share on other sites

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 = "auto-response@x.net";
$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

Link to comment
Share on other sites

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. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.