View Full Version : I have a good email script and +ve tests but email still work work

02-25-2008, 09:11 PM

I have tried everything and my email is not getting out :(

This is my script:

// Set up correct headers

$to = $N_email;


$headers ="MIME-Version:1.0\r\n";
$headers .="content-type:text/html; Charset=iso-8859-1\r\n";
$headers .= "From: " . "$name" . "<" . "$from" . ">\n";
$headers .= "Return-Path: <" . "$to" . ">\n";
$headers .= "Error-To: <" . "$to" . ">\n";
$headers .= "X-Sender: <" . "$to" . ">\n";
$headers .= "X-Mailer: PHP v".phpversion()."\n";

// subject
$subject = "As Promised ...Your Free Access .";
$subject= nl2br($subject);

$messageX = "test";


// Send email
mail($to, $subject, $message, $headers) ;

if (mail($to, $subject, $message, $headers) == false)
echo "Email failed";

echo "To: $to, <br>Subject: $subject, <br>Headers: $headers, <br>Message: $message";

$res = mail("my_name@hotmail.com", "Test php mailer for MY-SITE.net", "Hi,
this message proves that php email scripts are working on the domain MY-SITE.net", "From: root@my-site.net", "root@my-site.net");

if($res == 1){
echo "email sent successfully, check email to make sure it was recieved."; }

Well it should work and th results look like it does:

To: kevinRobby@my-site.com,
Subject: As Promised ...Your Free Access ,
Headers: MIME-Version:1.0 content-type:text/html; Charset=iso-8859-1 From: Dave Return-Path: Error-To: X-Sender: X-Mailer: PHP v5.2.5 ,

Message: testemail sent successfully, check email to make sure it was recieved.

It even shows the correct php version !

BUT no email arrives at either destination :confused:

Any ideas ?

02-25-2008, 09:19 PM
I have just been looking through the output from phptest.php on the website concerned:

here are some of the relevent params.

include_path .:/usr/lib/php:/usr/local/lib/php
log_errors On
open_basedir /home/letsget/:/usr/lib/php:/usr/local/lib/php:/tmp
sendmail_from no value
sendmail_path /usr/sbin/sendmail -t -i
SMTP localhost
smtp_port 25

what else should I check for ?

02-26-2008, 12:09 AM
Try a test with the following change to the headers:

$headers .= "From: $from\n";
$headers .= "Return-Path: $to\n";
$headers .= "Error-To: $to\n";
$headers .= "X-Sender: $to\n";