【发布时间】:2020-09-25 16:40:50
【问题描述】:
我刚刚开始在 Symfony5 中使用 Swiftmailer。问题是,当我在 localhost 服务器上使用 Symfony 运行它来发送电子邮件时,它会抛出上述错误。
$transport
->setUsername("mygmail@gmail.com")
->setPassword("pass");
$mailer = new Swift_Mailer($transport);
$message = new Swift_Message();
$message
->setFrom("mygmail@gmail.com")
->setTo("mygmail@gmail.com")
->setSubject("title")
->setBody("body of swift mailer");
$mailer->send($message);
config_dev.yml:
swiftmailer:
transport: gmail
username: mygmail@gmail.com
password: (my google app password)
php.ini:
[mail function]
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = mateuszwlecial03@gmail.com
sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t"
mail.add_x_header = Off
sendmail.ini:
smtp_server = smtp.gmail.com
smtp_port = 587
error_logfile = error.log
debug_logfile = debug.log
auth_username = mygmail@gmail.com
auth_password = (my google app password)
force_sender = mygmail@gmail.com
smtp_ssl=auto
我在任何地方都找不到这个问题。任何想法可能是这个问题的原因?
【问题讨论】:
标签: php symfony xampp localhost swiftmailer