Friday, July 29, 2011

How to test phpmail()


Create a php script as below.

root@cpanel [~]# cat test.mail
$to      = '';
$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.

No comments:

Post a Comment

Be nice. That's all.