View Full Version : Needing help on confirmation email

02-14-2008, 03:28 AM
I have the following php script for my contact page. I am wanting to add a feature to where it will send the user a copy of the email that I am getting. Here is the code I have. Any help would be great.


$name_recipient = "Timbo";
$email_recipient = "mail@mail.net";
$name_sender = $_POST['lastname'];
$email_sender = $_POST['email'];
$subject = "Feedback/Comments From 52Designs.net";
$headers = "From: ".$name_sender." <".$email_sender.">\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$message = "
<body text=FFFFFF background=bg.gif>
<center><table width=500 border=1 cellspacing=1 cellpadding=1 background=emailbg.gif>
<tr><td align=center colspan=2 bgcolor=000000><img src=52DIB2L.gif></td></tr>
<tr><td colspan=2 align=center><b>Contact Information</b></td></tr>
<tr><td align=left>Name:&nbsp;&nbsp;</td><td>".$_POST['Name']."</td></tr>
<tr><td align=left>Company:&nbsp;&nbsp;</td><td>".$_POST['Company']."</td></tr>
<tr><td align=left>E-Mail:&nbsp;&nbsp;</td><td>".$_POST['email']."</td></tr>
<tr><td align=left>Phone Number:&nbsp;&nbsp;</td><td>".$_POST['Phone']."</td></tr>
<tr><td align=left>Address:&nbsp;&nbsp;</td><td>".$_POST['Address']."</td></tr>
<tr><td align=left>City/State/Zip Code:&nbsp;&nbsp;</td><td></td>".$_POST['csz']."</tr>
<tr><td align=left>How to contact:&nbsp;&nbsp;</td><td>".$_POST['Contact_Preference']."</td></tr>
<tr><td align=left>Message:&nbsp;&nbsp;</td><td>".$_POST['Message']."</td></tr></table></center>


$bericht = nl2br($message);
mail($email_recipient, $subject, $message, $headers);


02-14-2008, 04:42 AM
The PHP manual's page on mail() (http://us3.php.net/manual/en/function.mail.php) contains examples of how to send email to multiple recipients.

02-14-2008, 07:16 PM
I don't think you'd want to send a copy of it to the user though. You'd more likely send a separate email that thanks the user and lets them know it has been received.

BTW: Hallo :)

02-14-2008, 07:29 PM
thanks for the info. Last night after messing around with it, i just kinda thought of how it may do it and tried it and it did. But thanks for the website and your help. Yeah I am kinda new to php, i have worked with it before but nothing ever in depth. I am wanting to know more about how everything works. Thanks Guys