0
下面的函數來發送電子郵件,但有任何郵件或錯誤:PHPMailer的郵件無法發送,並沒有得到任何錯誤
function send_Email($email, $subject, $body ,$cc = '')
{
$this->Log("Sending email with To: ". $email. " <br>Subject: ". $subject ." <br>Body: ".$body);
$mail = new PHPMailer();
$mail->IsHTML(true);
$mail->IsSMTP();
$mail->CharSet = "utf-8";
$mail->SMTPAuth = true;
$mail->SMTPSecure = "tls";
$mail->Host = email_host;
$mail->Username = email_username;
$mail->Password = email_password;
$mail->SetFrom('[email protected]', 'zzz Support');
$mail->AddReplyTo('[email protected]', 'zzz Support');
$mail->AddAddress($email);
$mail->AddBCC('[email protected]');
$mail->AddBCC('[email protected]');
if(!empty($cc)) {
$mail->addCC($cc);
}
$mail->Subject = $subject;
$mail->Body = $body;
echo "<pre>"; print_r($mail);echo "</pre>";
$response = $mail->Send();
var_dump($response);
return $response;
}
調試:在調試模式下得不到錯誤 [ERROR_COUNT:保護] => 0
您在哪裏發送郵件?您可以先使用[FakeSMTP](https://github.com/Nilhcem/FakeSMTP)等工具測試轉儲郵件。 –
這是'回聲'
「;'打印什麼?或'var_dump'? –var_dump(false)....... – sudhir