That code is not sending the email. $mail->AddCC() is referencing a class that defines the real functions that operate the email. Without knowing what that is, this looks like it would work, assuming the class operates in a way that fits in with that-- but we'd need to see the class to know.
However, you are not creating an array. You are creating a string.
Change this: $ccsChecked = ""; to $ccsChecked = array();
And this: $ccsChecked .= "$value2 "; to $ccsChecked[] = $value2;
Now this: $ccAddresses = array($ccsChecked);
can be just $ccAddresses = $ccsChecked, or, simpler, just use $ccAddresses throughout the script and skip $ccsChecked all together.
One big problem with this is that you are not doing any validation, so people could be sending emails to anyone they want (spamming). So to fix this, you can verify the array against a real array of emails:
PHP Code:
$allowedEmails = array('1@1.1','2@2.2',....);
foreach ($ccAddresses as $ccK=>$ccV) {
if (!in_array($ccV,$allowedEmails)) { unset($ccAddresses[$ccK]); }
}
Bookmarks