我试图使用AddAddress向用户发送电子邮件,并通过CC向管理员等发送另外三封电子邮件
我可以使用AddAdress((发送电子邮件,但不能使用AddCC。
下面是我的代码
<?php
require("class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.test.com.my"; // SMTP server
$mail->From = "enquiry@test.com.my";
$mail->AddAddress($email);
$mail->Subject = "Colourful email";
$mail->Body =$message;
/*$mail->WordWrap = 50;*/
$mail->AddCC =($email_1);
$mail->AddCC =($email_2);
$mail->AddCC =($email_3);
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
} else {
echo 'Kindly check your email for the confirmation of your rental.Thank you.';
}
?>
您不需要在此中=
$mail->AddCC($email_1);
尝试使用此附加参数
$mail->AddCC('person1@domain.com', 'Person One');
$mail->AddCC('person2@domain.com', 'Person Two');
这里只是一个拼写错误。该方法为addCC(string $address, string $name = '') : boolean
,小写为"a">