使用php邮件时发生的重复电子邮件不一致。
邮件功能:
function SendEmail($to,$cc,$bcc,$subject,$body) {
require( GetPHPMailPath() );
$mail = new PHPMailer();
$addresses = explode(',', $to);
foreach ($addresses as $address) {
$mail->AddAddress($address);
}
if($cc!='') {
$mail->addCustomHeader("CC: " . $cc);
}
if($bcc!=''){
$mail->addCustomHeader("BCC: " . $bcc);
}
$mail->IsSMTP();
$mail->SMTPAuth = true; // turn on SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587;
$mail->Username = "email@email.com"; // SMTP username
$mail->Password = "password"; // SMTP password
$webmaster_email = "email"; //Reply to this email ID
$name=$email;
$mail->From = $webmaster_email;
$mail->FromName = "Service";
$mail->WordWrap = 50; // set word wrap
$mail->IsHTML(true); // send as HTML
$mail->Subject = $subject;
$mail->Body = $body;
return $mail->Send();
}
我如何调用该函数:
echo SendEmail($toAddress,$ccAddress,$bccAddress,$subject,$body);
关于这整个考验的真正奇怪之处在于它是不一致的,这意味着代码可能没有任何问题,但与gmail的连接?
任何想法都可能是php.ini
问题?
答案 0 :(得分:1)
这是与延迟相关的问题。
PHPMailer功能正常。用户发送了重复的请求。通过添加比较检查与MySQL数据库记录来修复。