The following code is sending an email from my website, but the email comes from cgi-mailer@kundenserver.de
, how do i change this to the sender's email address, which i have given the variable $email
:
<?php
if(isset($_POST['submit'])) {
$msg = 'Name: ' .$_POST['FirstName'] .$_POST['LastName'] ."
"
.'Email: ' .$_POST['Email'] ."
"
.'Message: ' .$_POST['Message'];
$email = $_GET['Email'];
mail('me@example.com', 'Message from website', $msg );
header('location: contact-thanks.php');
} else {
header('location: contact.php');
exit(0);
}
?>
Adding the header From:
to my mail command seems to allow me to change the email address, but i can't work out how to do it to the variable.