2 回答

TA貢獻1801條經驗 獲得超8個贊
為解決這個問題使用try ... catch
$mail=new PHPMailer(true);
try {
$mail->CharSet = 'utf-8';
$mail->isSMTP();
$mail->isHTML(true);
$mail->Host = 'smtp.strato.de';
$mail->Port = 587;
$mail->SMTPAuth = false;
$mail->Username = 'xxxx';
$mail->Password = 'xxxx';
$mail->SMTPSecure = 'tls';
$mail->SMTPDebug = 0;
$mail->MailerDebug = false;
$mail->setFrom($absender, $name);
$mail->addAddress($to);
$mail->Subject = $subject;
$mail->Body = $message_other_player;
}
$mail->send();
// echo 'Message has been sent';
} catch (Exception $e) {
// echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}

TA貢獻1725條經驗 獲得超8個贊
警告:下面的代碼有點工作,但它不是真正的解決方案,它只是移動了問題,因為 SMTP 被忽略了:
看起來這個簡單的改變實際上解決了它。我認為它只會解決問題,但它現在似乎有效。
//?$mail->isSMTP();
只需評論或刪除“isSMTP()”
- 2 回答
- 0 關注
- 224 瀏覽
添加回答
舉報