Hi all,
How do I set the from field in an email using PHP?
When the email is sent I want the users name to appear in from field and their email address to appear as Reply To.
Any ideas?
Thanks.
// create headers
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
$headers .= "From: \n";
// set variables
$mailcontent = 'Name: '.$name."\n"
.'Email: '.$email."\n"
.'Telephone: '.$phone."\n"
.'Address: '.$address."\n"
.'Comments: '.$comments."\n";
$subject = 'LA Flowers Contact Form';
$fromaddress = 'From: '.$email;
$toaddress = 'info@mysite.com';
// remove backslashes
$mailcontent = Stripslashes($mailcontent);
$fromaddress = Stripslashes($fromaddress);
// send email
$mail = mail($toaddress, $subject, $mailcontent, $headers);