开发者

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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜