-3

I want to set a Dynamic Header on mail header when i send mail. I don't want to do it with SMPT server and if it will be in codeigniter, so it will be greate. You will get idea what exactly i want by given image bellow.

from: Google < dynamic email@gmail.com >

enter image description here

My Code

<?php
if(isset($_POST['send'])) {

  //Email information
  $email = $_POST['email'];
  $subject = $_POST['subject'];
  $comment = $_POST['comment'];

  //send email
  mail($email, "$subject", $comment, "From:" . $email);

  //Email response
  echo "Thank you for contacting us!";
}

//if "email" variable is not filled out, display the form
else {
?>
  <form method="post" name="testmail">
    Email: <input name="email" type="text" />
    Subject: <input name="subject" type="text" />
    Message:<textarea name="comment" rows="15" cols="40"></textarea>
    <input type="submit" name="send" value="Submit" />
  </form>
<?php } ?>
Rudra
  • 535
  • 4
  • 16

1 Answers1

-1

use like this:

mail(to,subject,message,headers,parameters);

Sachin Aghera
  • 486
  • 3
  • 8
  • It is not working . Its showing errors like **Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.** – Rudra May 19 '18 at 05:30
  • can u suggest me how to configure it, i have linux base server. – Rudra May 19 '18 at 05:31