PHP Code to Mail CC:

How would I add a courtesy copy CC: email address to this code? The variable for the email address is named $Email2

Below is the code I have now:

if (mail($Email, $Subject, $Message, $Headers))

Open in new window


I've tried different variations such as putting the $Email2 in different locations. The email still sends but the subject line is the email address if I add the variable to as such:

if (mail($Email, $Email2, $Subject, $Message, $Headers))

I actually don't need it to CC:, if I could just fix it so the $Email2 is on the TO: line, that would also be fine.
LVL 15
wantabe2Asked:
Who is Participating?
 
Lukasz ChmielewskiConnect With a Mentor Commented:
You need to look to the $Headers:
http://php.net/manual/en/function.mail.php
Like Example #4
0
 
wantabe2Author Commented:
Cool website & thanks! I referenced the top 4 lines of example 4 & it worked like a charm!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.