curtis100 Posted October 21, 2008 Share Posted October 21, 2008 Hi there I hope someone can help me. I've been asked to update a mail form. I can sort out the basics but I can't quite figure out one thing. I've been asked if the mail that is generated by the form can be cc'd to the email address entered into the form field for the users email address. The current form code looks like this. <? $message = "This general enquiry was made on ".date ("l dS of F Y h:i:s A")."\n"; $message .= "\nBUSINESS CARD REQUEST FROM a website.COM\n"; $message .= "======================================================================================"; $to = "[email protected]"; $cc = "email from form"; $subject = ",Business Card Request"; $message .="\n"; $message .= "First Name: ".$_REQUEST['name_first']; $message .="\n"; $message .= "Surname: ".$_REQUEST['name_surname']; $message .="\n"; $message .= "Job Title: ".$_REQUEST['job_title']; $message .="\n"; $message .= "Department: ".$_REQUEST['department']; $message .="\n"; $message .= "Address 1: ".$_REQUEST['address_1']; $message .="\n"; $message .= "Address 2: ".$_REQUEST['address_2']; $message .="\n"; $message .= "Suburb: ".$_REQUEST['suburb']; $message .="\n"; $message .= "State: ".$_REQUEST['state']; $message .="\n"; $message .= "Postcode: ".$_REQUEST['postcode']; $message .="\n"; $message .= "Telephone: ".$_REQUEST['telephone']; $message .="\n"; $message .= "Facsimile: ".$_REQUEST['facsimile']; $message .="\n"; $message .= "Mobile: ".$_REQUEST['mobile']; $message .="\n"; $message .= "Email: ".$_REQUEST['Email']; $message .="\n"; $message .= "appointments on rear: ".$_REQUEST['appointments']; $message .="\n"; $message .= "Special Request: ".$_REQUEST['specials']; $message .="\n"; $message .= "\nlocalhost:8888/test/";mail ( "[email protected]","website.com.au Business Card Request",$message); header('Location: http://localhost:8888/test/forms/thankyou.html'); ?> Any help anyone can give will be greatly appreciated. Regards, Curtis Link to comment https://forums.phpfreaks.com/topic/129352-passing-email-variable-into-cc-in-php-mail-form/ Share on other sites More sharing options...
Bendude14 Posted October 21, 2008 Share Posted October 21, 2008 here where your sending the mail mail ( "[email protected]","website.com.au Business Card Request",$message); assign it to a variable then check if that var is set. If so build another message and sent it to the users email address $mailSent = mail ( "[email protected]","website.com.au Business Card Request",$message); if($mailSent) { //email was sent so build new message //then send using mail() again but using the retrieved email address } Link to comment https://forums.phpfreaks.com/topic/129352-passing-email-variable-into-cc-in-php-mail-form/#findComment-670626 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.