我有這樣的PHPMailer:https://github.com/PHPMailer/PHPMailer/的PHPMailer不會發送郵件
我的代碼是這樣的:
$mail = new PHPMailer;
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'kms-play.it'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = 'pass'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
$mail->From = '[email protected]';
$mail->FromName = 'KMS-Play';
$mail->addAddress('[email protected]', 'Lars Mehrhoff'); // Add a recipient
#$mail->WordWrap = 50; // Set word wrap to 50 characters
#$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
#$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
#$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
echo 'Message has been sent';
和錯誤是:
2013-12-15 15:02:23 CLIENT -> SERVER: EHLO local.kms-play.it 2013-12-15 15:02:23 CLIENT -> SERVER: STARTTLS 2013-12-15 15:02:23 SMTP ERROR: STARTTLS command failed: 502 5.5.1 Error: command not implemented 2013-12-15 15:02:23 CLIENT -> SERVER: QUIT SMTP connect() failed. Message could not be sent.Mailer Error: SMTP connect() failed.
你肯定'公里,play.it'支持TLS連接? – Ohgodwhy
通過問題標題,我通過PHPMailer宣佈關閉服務。 – silentboy
沒有TLS它說:'2013-12-15 15:10:33客戶端 - >服務器:EHLO local.kms-play.it 2013-12-15 15:10:33客戶端 - >服務器:AUTH LOGIN 2013-12 -15 15:10:33 SMTP ERROR:AUTH命令失敗:535 5.7.8錯誤:身份驗證失敗:身份驗證機制無效2013-12-15 15:10:33 CLIENT - > SERVER:QUIT SMTP connect()失敗。郵件無法發送。郵件錯誤:SMTP連接()失敗。' – Evolutio