How to use mail() function in php?

How to use mail() function in php?

mail() function

<?php
$to      = 'receiver@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: sender@example.com' . "rn" .
'Reply-To: sender@example.com' . "rn" .
'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

Note:-  $to, $subject, $message parameters are require for send mail and headers are optional parameter, you con use header parameter for add additional body mail.

Leave a Comment