2
我正在使用PHPMailer編寫一個PHP腳本來發送automaticaly電子郵件。 出於測試目的,我使用了一個帶有應用程序密碼的Gmail帳戶,一切正常。 當我用我的專業電子郵件替換Gmail帳戶配置時,PHP連接腳本會持續加載一段時間,並以此消息結束。 SMTPDebug設置爲3.無法使用PHPMailer遠程連接到我的電子郵件服務器
2015-11-16 22:43:30 SERVER - >客戶端:+確定Dovecot已準備就緒。 2015-11-16 22:43:30客戶端 - >服務器:EHLO localhost
這是什麼意思?
這裏是一個即時通訊使用,以測試到電子郵件服務器
<?php
require('../PHPMailer-master/PHPMailerAutoload.php');
function smtpMailer() {
$mail = new PHPMailer();
$mail->IsSMTP(); // active SMTP
$mail->SMTPDebug = 2;
$mail->Host = 'mail.mycompany.com';
$mail->Port = 587;
//$mail->Username = "[email protected]";
//$mail->Password = "mypassword";
$mail->SetFrom = "[email protected]";
$mail->FromName = 'foxy';
$mail->addAddress('[email protected]', 'John Doe');
$mail->WordWrap = 50;
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the body in plain text ';
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
}
smtpMailer();
?>
錯誤
2015-11-17 01:44:14 SERVER -> CLIENT: 220 mycompany.com ESMTP Ready 2015-11-17 01:44:14
CLIENT -> SERVER: EHLO localhost 2015-11-17 01:44:14
SERVER -> CLIENT: 250-mycompany.com Hello localhost 250 HELP 2015-11-17 01:44:14
CLIENT -> SERVER: MAIL FROM: 2015-11-17 01:44:15
SERVER -> CLIENT: 250 [email protected] Sender ok 2015-11-17 01:44:15
CLIENT -> SERVER: RCPT TO: 2015-11-17 01:44:16
SERVER -> CLIENT: 503 non-authenticated user. Please check mail before sending. 2015-11-17 01:44:16 SMTP ERROR: RCPT TO command failed: 503 non-authenticated user. Please check mail before sending. 2015-11-17 01:44:16
CLIENT -> SERVER: QUIT 2015-11-17 01:44:16
SERVER -> CLIENT: 221 goodbye. 2015-11-17 01:44:16 SMTP Error: The following recipients failed: [email protected]: non-authenticated user. Please check mail before sending.
Mailer Error: SMTP Error: The following recipients failed: [email protected]: non-authenticated user. Please check mail before sending.
謝謝連接PHP函數。
是的它的工作,但刪除後 $ mail-> SMTPAuth = true; 謝謝 – samouss