skip to Main Content

I tried to do:

<?php
$name = $_POST['yourname'];
$email = $_POST["youremail"];
$message = $_POST["yourmessage"];
$to = "[email protected]";
$subject = "messages";
mail($to, $subject, $message,$email);
?>

And failed? What am I doing wrong? I am trying on live host – Cpanel

2

Answers


  1. I’ve run into the same problem a few times, and for me this seems to do the trick.

    mail($to, "From: ".$email, "$subject", $message);
    

    Adding the "From: " and the quotes around subject for whatever reason make it work.

    Login or Signup to reply.
  2. **try this** 
    
    mail($to, $subject,$message,$headers)
    
    $to=.....@...;
    $subject="Contact Details";
    $message='<h3>Hai</h3>';
    $message.='<h4>Welcome</h4>';
    $headers="Content-Type: text/html; charset=ISO-8859-1rn";
    $headers.= "MIME-Version: 1.0rn";
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search