0
我一直有一些麻煩試圖設置PHP梅勒。 我不斷收到此錯誤。我已禁用並在php.ini中啓用了extension = php_openssl.dll。我已啓用訪問安全性較低的應用程序,打開imap,但什麼也沒有。PHP郵件程序SMTP錯誤命令失敗
2017-05-05 09:33:09 SERVER -> CLIENT: 220 smtp.gmail.com ESMTP v7sm1232085wme.5 - gsmtp
2017-05-05 09:33:09 CLIENT -> SERVER: EHLO Gonþalo-PC
2017-05-05 09:33:10 SERVER -> CLIENT: 501-5.5.4 HELO/EHLO argument "Gonþalo-PC" invalid, closing connection.
501 5.5.4 https://support.google.com/mail/?p=helo v7sm1232085wme.5 - gsmtp
2017-05-05 09:33:10 SMTP ERROR: EHLO command failed: 501-5.5.4 HELO/EHLO argument "Gonþalo-PC" invalid, closing conn
ection.
501 5.5.4 https://support.google.com/mail/?p=helo v7sm1232085wme.5 - gsmtp
2017-05-05 09:33:10 CLIENT -> SERVER: HELO Gonþalo-PC
2017-05-05 09:33:10 SERVER -> CLIENT:
2017-05-05 09:33:10 SMTP ERROR: HELO command failed:
2017-05-05 09:33:10 SMTP NOTICE: EOF caught while checking if connected
2017-05-05 09:33:10 SMTP Error: Could not connect to SMTP host.
2017-05-05 09:33:10 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
我使用XAMPP V.3.2.2,PHP 7.1.2,COMPOSER 5.2。
這裏是我的代碼
<?php
date_default_timezone_set('Etc/UTC');
require 'vendor/autoload.php';
require_once 'buscar_lembretes.php';
$lembretes = buscarLembretes();
foreach ($lembretes as $lembrete) {
$mail = new PHPMailer;
$mail->isSMTP();
$mail->SMTPDebug = 2;
$mail->Host = 'smtp.gmail.com';
$mail->Port = 587;
$mail->SMTPSecure = 'tls';
$mail->SMTPAuth = true;
$mail->Username = "[email protected]";
$mail->Password = "mypassword";
$mail->setFrom('[email protected]', 'Lembrestes App');
$mail->addAddress($lembrete['email'], $lembrete['email']);
$mail->Subject = 'Lembrete';
$mail->Body = $lembrete['descricao'];
$mail->send();
}
感謝