[英]How to add the second email address in the body of this email?
What is the correct way to add $email_2
to the body of this email?将$email_2
添加到此 email 正文的正确方法是什么?
$mail->addCC($email);
$mail->addCC($email_2);
/*$mail->addBCC('bcc@example.com');*/
//Body content
$body = "<p><strong>Hello, </strong>" . $email . " Your message was sent.
What I've tried:我试过的:
//Body content
$body = "<p><strong>Hello, </strong>" . $email . " ". $email_2 ." Your message was sent.
Your code is almost correct, you need to close the quote and add a semicolon at the end as well as a paragraph closing.您的代码几乎是正确的,您需要关闭引号并在末尾添加分号以及段落结束。 Let's create a paragraph for each email:让我们为每个 email 创建一个段落:
$mail->addCC($email);
$mail->addCC($email_2);
/*$mail->addBCC('bcc@example.com');*/
//Body content
$body = "";
foreach ([$email, $email_2] as $current) {
$body .= "<p><strong>Hello, </strong>" . $current . " Your message was sent.</p>";
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.