PDA

View Full Version : PHP Mail Script Help



Sammie
May 1st, 2009, 09:46
Hi Guys,

How would it be possible to edit the following to allow for the Full name of the client to go in the header of my email etc? So it would be like 'Josh Ladner <atestman@hotmail.com>' the name of my input box is 'name'


<?php
$to = "myinbox@gmail.com";
$subject = "Quote Requested";
$email = $_REQUEST['mail'] ;
$message = $_REQUEST['msg'] ;
$headers = "From: $email" .
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Thankyou, you have successfully sent your quote request to the Pixale staff. We will read over your quote in the coming day and send you an email with more details."; }
else
{print "Due to an unspecified error, we could not send your quote. Please go back."; }
?>

Thankyou:beer:

Exa_Ankur
May 5th, 2009, 04:55
This should work - haven't tested it though:



<?php
$to = "myinbox@gmail.com";
$subject = "Quote Requested";
$email = $_REQUEST['mail'] ;
$name = $_REQUEST['name'] ;
$message = $_REQUEST['msg'] ;
$headers = "From: $name <$email>" .
$sent = mail($to, $subject, $message, $headers) ;
if($sent)
{print "Thankyou, you have successfully sent your quote request to the Pixale staff. We will read over your quote in the coming day and send you an email with more details."; }
else
{print "Due to an unspecified error, we could not send your quote. Please go back."; }
?>