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 = "support@xxx.com 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("ian@xxx.com","adam@xxx.com","keith@xxx.com","sue@xxx.com","mark@xxx.com","scott@xxx.com","joyce@xxx.com","joe@xxx.com","ken@xxx.com","info@xxx.com"))) $to = "support@xxx.com"; $subject = "Order"; Quote Link to comment 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: sendcopyto@test.com' . "\r\n"; mail($to,$subject,$content,$header); Or you could use multiple recipient addresses: $to = $selected_email.', sendcopyto@test.com'; $subject = 'subject'; $content = 'this goes to multiple addresses'; mail($to,$subject,$content); Quote Link to comment 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 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.