php email - $to multiple recipients
Even this must have been be asked many times, I will ask aga开发者_开发知识库in since I cannot get it to work.
I am using php mail($to, $subject, $message, "From: $mysite<$myemail>\nX-Mailer:PHP/" .phpversion());
to send email to a single recipient.
Now I need to sent it to more than one recipients. I know that normaly I could do:
$to = "emailA@here.com,emailB@there.com";
But I need the one of the recipients to be the user that fills in the form e.g.:
//get all form details
$email = $_POST['email'];
$to = "$email,emailB@there.com";
The above ($to) I don't know if it is correct or not but is not working for me...
If I leave only the $to = "$email";
it gets send to $email (meaning that my rest of the code is ok).
Any suggestion on what is or may be wrong here?
Thank you.
Add a CC to your header.
$header ="From: $mysite<$myemail>" . PHP_EOL;
$header .= 'CC: emailB@there.com' . PHP_EOL;
//Rest of headers here
精彩评论