Friday, July 29, 2011

How to test phpmail()

Sponsored Links
Create a php script as below.

root@cpanel [~]# cat test.mail
$to      = 'username@gmail.com';
$subject = 'testing phpmail';
$message = 'hello';
$headers = 'From:yourname' . "\r\n" .
    'Reply-To: yourname' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
root@cpanel [~]#
Now execute the command as below to send mail
root@cpanel [~]# php test.mail
Thats it. Check your inbox. If everything is it, it'll be delivered successfully.

Sponsored Links

No comments:

Post a Comment

Be nice. That's all.