我希望将联系表单发送到多个地址。目前代码是
$to = 'email@email.com';
代码的下方是
function xmail($to,$subject,$message,$headers){
global $usesmtp,$smtphost,$smtpport,$smtpuser,$smtppass,$smtpsecure,$_POST;
if($usesmtp!=1){
if(@mail($to,$subject,$message,$headers)){
return 1;
}
}else{
require_once('mail/class.phpmailer.php');
$mail = new PHPMailer();
$body =$message;
$mail->IsSMTP();
$mail->SMTPDebug = 0;
$mail->SMTPAuth = true;
$mail->SMTPSecure = $smtpsecure;
$mail->Host = $smtphost;
$mail->Port = $smtpport;
$mail->Username = $smtpuser;
$mail->Password = $smtppass;
$mail->SetFrom($_POST['email'], $_POST['name']);
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($address, "Administrator");
if($mail->Send()) {
return 1;
}
}
}
有人可以帮忙吗?
答案 0 :(得分:0)
更改
$to = 'email@email.com';
要
$to = 'email@email.com, email2@email2.com';