Я использую Windows 10 с cmd.
Я запускаю свой пример. php файл с php example.php
, и я получаю эту ошибку:
PHP Fatal error: Uncaught Swift_TransportException: Failed to authenticate on SMTP server with username "mateusz" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials v26sm4139501lji.43 - gsmtp
". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials v26sm4139501lji.43 - gsmtp
". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials v26sm4139501lji.43 - gsmtp
". in C:\xampp\htdocs\php\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\Esmtp\AuthHandler.php:191
Stack trace:
#0 C:\xampp\htdocs\php\vendor\swiftmailer\ in C:\xampp\htdocs\php\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\Esmtp\AuthHandler.php on line 191
Fatal error: Uncaught Swift_TransportException: Failed to authenticate on SMTP server with username "mateusz" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials v26sm4139501lji.43 - gsmtp
". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials v26sm4139501lji.43 - gsmtp
". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials v26sm4139501lji.43 - gsmtp
". in C:\xampp\htdocs\php\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\Esmtp\AuthHandler.php:191
Stack trace:
#0 C:\xampp\htdocs\php\vendor\swiftmailer\ in C:\xampp\htdocs\php\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\Esmtp\AuthHandler.php on line 191
Это мой пример. php файл:
<?php
require "vendor/autoload.php";
$transport = new Swift_SmtpTransport("ssl://smtp.gmail.com", 465);
$transport->setUsername('mateusz');
$transport->setPassword('my_password');
$mailer = new Swift_Mailer($transport);
$message = new Swift_Message();
$message->setFrom('my_email');
$message->setTo('my_email');
$message->setSubject('hello title');
$message->setBody('body random text');
$mailer->send($message);
Это мой composer. json файл:
{
"name": "mateu/php",
"require": {
"swiftmailer/swiftmailer": "^6.2"
},
"authors": [
{
"name": "velewqqw",
"email": "123k@gmail.com"
}
]
}
composer - версия:
Composer version 1.10.5 2020-04-10 11:44:22
В чем может быть проблема? Спасибо за помощь.