PHP mail() not working

Status
Not open for further replies.

dreamca2

New Member
Messages
2
Reaction score
0
Points
0
I've been trying to send a simple email using mail() but the emails have not arrived at any of the accounts, aol, gmail and live.

I've tried using this test code that others posted:

PHP:
<?php
// TEST OF THE MAIL SYSTEM USING PHP mail()
// this must be a valid email account on your domain

$from = "xxx@xxx.com";

// DOES NOT BOUNCE BACK FROM hotmail!!

$to="xxxx@xxx.com";


$mailbody="Test message sent (PST): \n" . date('l jS \of F Y h:i:s A');
$subject="Test of PHP mail()" ;

// NOT text/html
$headers = "Content-type: text/plain; charset=windows-1251 \r\n";

$headers .= "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "X-Mailer: PHP/" . phpversion();

$resp = mail($to, $subject, $mailbody, $headers);

if( $resp ){
$outcome = "Mail sent" ;
} else {
$outcome = "Mail not sent";
}

print "\nThe mail system said: $outcome\n\n" ;
exit();
?>

and although it reports: "Mail sent" the email still does not arrive at any of my accounts. I'm using free hosting on server Level. How do I fix this problem?
 

Dead-i

x10Hosting Support Ninja
Community Support
Messages
6,084
Reaction score
368
Points
83
Portion of your code:
$headers .= "From: $from\r\n";
I might be wrong, but I'm pretty sure our mail server doesn't allow the spoofing of the From field.
Please try remove this header and see whether it works. :)

Thank you
 
Status
Not open for further replies.
Top