PHP mail() issue

Seems like you are trying to make use of additional parameters.

Exerpt from PHP Manual

The additional_parameters parameter can be used to pass an additional
parameter to the program configured to use when sending mail using the
sendmail_path.

<?php
mail('[email protected]', 'the subject', 'the message', null, '[email protected]');
?>

Route : 2

Try something like this.

Your $from is contained in the $headers variable itself , so you don’t have to specify.

 <?php
    $to      = '[email protected]';
    $subject="the subject";
    $message="hello";
    $headers="From: [email protected]" . "\r\n" .
        'Reply-To: [email protected]' . "\r\n" .
        'X-Mailer: PHP/' . phpversion();

   if(mail($to, $subject, $message, $headers))
    { #And finally send them a thanks
   header('Location: thanks.html.php');
   exit();
   } else {
   echo 'Email did not send';
   exit();
   }   
   ?>

Leave a Comment