2 回答

TA貢獻(xiàn)1801條經(jīng)驗(yàn) 獲得超8個(gè)贊
為解決這個(gè)問(wèn)題使用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貢獻(xiàn)1725條經(jīng)驗(yàn) 獲得超8個(gè)贊
警告:下面的代碼有點(diǎn)工作,但它不是真正的解決方案,它只是移動(dòng)了問(wèn)題,因?yàn)?SMTP 被忽略了:
看起來(lái)這個(gè)簡(jiǎn)單的改變實(shí)際上解決了它。我認(rèn)為它只會(huì)解決問(wèn)題,但它現(xiàn)在似乎有效。
//?$mail->isSMTP();
只需評(píng)論或刪除“isSMTP()”
- 2 回答
- 0 關(guān)注
- 233 瀏覽
添加回答
舉報(bào)