macrat101 Posted September 4, 2010 Share Posted September 4, 2010 I have a php contact form that works perfectly. It has a drop down list, and the forms results are emailed to the selected drop down persons email address. I want to add a Cc function to the form ... so that there is a copy, or record of all emails sent. The address $to = "[email protected] is the one that I want the Cc to go to, but I don't know how to make it work. Not sure how to do this. Below is what I have ... how do I integrate the Cc function into the script. ________________________________________________________________________________________ $to = $_POST["to"]; if(!in_array($to,array("[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]","[email protected]"))) $to = "[email protected]"; $subject = "Order"; Quote Link to comment https://forums.phpfreaks.com/topic/212491-trying-to-add-a-cc-function-to-a-php-contact-form/ Share on other sites More sharing options...
ldb358 Posted September 4, 2010 Share Posted September 4, 2010 there are two ways to send a copy of every email to two addresses: you could pass a cc header: $to = $selected_email; $subject = 'subject'; $content = 'this goes to multiple addresses'; $header 'Cc: [email protected]' . "\r\n"; mail($to,$subject,$content,$header); Or you could use multiple recipient addresses: $to = $selected_email.', [email protected]'; $subject = 'subject'; $content = 'this goes to multiple addresses'; mail($to,$subject,$content); Quote Link to comment https://forums.phpfreaks.com/topic/212491-trying-to-add-a-cc-function-to-a-php-contact-form/#findComment-1107107 Share on other sites More sharing options...
pornophobic Posted September 4, 2010 Share Posted September 4, 2010 What are you using to send the mail itself? Are you using the mail() construct, or using something else like the SMTP class from PEAR? If it's mail(), you need to add the CC in the extra headers for the mail. http://php.net/manual/en/function.mail.php If it's anything else, you should refer to the documentation for what you're using. Quote Link to comment https://forums.phpfreaks.com/topic/212491-trying-to-add-a-cc-function-to-a-php-contact-form/#findComment-1107110 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.