<?php
// First mail
$mail_to = "jghomim@yahoo.com";
$mail_from = "jghomim@yahoo.com";
$mail_reply_to = "hatami@yahoo.com";
$mail_cc = "someoneelse@yahoo.com, yetanotherone@yahoo.com";
$mail_bcc = "mole@yahoo.com";
$mail_headers = "From: $mail_from\r\nReply-to: $mail_reply_to\r\nCc: $mail_cc\r\nBcc: $mail_bcc";
$mail_subject = " PHP mail test!";
$mail_body = "I want to test mail in PHP. Response now me!";
if(mail($mail_to, $mail_subject, $mail_body, $mail_headers))
    echo("Successfully sent an email titled '$mail_subject'!");
else {
    echo("An error occurred while attempting to send an email titled '$mail_subject'!");
   $errorMessage = error_get_last()['message'];
   print_r($errorMessage);
    }
?>
