Is the PHP mail( ) function working? It seems to not for me.

Status
Not open for further replies.

edudrone

New Member
Messages
1
Reaction score
0
Points
0
Hey!
I used the mail() function in php but am unable to receive any mails on the desired email id.

Can anyone help me on this?
 

lnxx10bz

New Member
Messages
53
Reaction score
0
Points
0
They may be blocked by the receiving server. Have you tried sending them to another e-mail address?
 

springbox99

Member
Messages
114
Reaction score
3
Points
18
It works for me.
Try this :
<?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();
?>
 
Status
Not open for further replies.
Top