I am trying to send email from server which runs locally by xampp. Could you please help me to find possible solution?
I am sure I've used the correct email and password. SMPT port in php.ini and sendMail.ini is also set to port 25.
my php code:
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'vendor/autoload.php';
$mail = new PHPMailer(true);
try {
//Server settings
$mail->SMTPDebug = 2;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'mygmailadress@gmail.com';
$mail->Password = 'mypassword';
$mail->Port = 25;
$mail->setFrom('from@example.com', 'Mailer');
$mail->addAddress('mygmailadress@gmail.com', 'Joe User');
$mail->isHTML(true);
$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';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo 'Message could not be sent. Mailer Error: ', $mail->ErrorInfo;
}
PHP responded with error:
SERVER -> CLIENT: 421 Cannot connect to SMTP server 64.233.166.108 (64.233.166.108:25), connect error 10060
CLIENT -> SERVER: EHLO localhost
SERVER -> CLIENT:
SMTP ERROR: EHLO command failed:
SMTP NOTICE: EOF caught while checking if connected
SMTP Error: Could not authenticate.
SMTP Error: Could not authenticate.
Message could not be sent. Mailer Error: SMTP Error: Could not authenticate.
Thank you :)