PHP Symfony Swift_Mailer错误:#无法从后端获取响应:格式错误的MIME标头:缺少冒号:%!!(MISSING)q(MISSING)#5 {main}

问题描述 投票:1回答:1

我刚刚开始在Symfony5中使用Swiftmailer。问题是,当我在本地服务器上使用Symfony运行此程序以发送电子邮件时,它会引发如上所述的错误。

                $transport
                    ->setUsername("[email protected]")
                    ->setPassword("pass");

                $mailer = new Swift_Mailer($transport);

                $message = new Swift_Message();
                $message
                    ->setFrom("[email protected]")
                    ->setTo("[email protected]")
                    ->setSubject("title")
                    ->setBody("body of swift mailer");

                $mailer->send($message);

config_dev.yml:

swiftmailer:
  transport: gmail
  username: [email protected]
  password: (my google app password)

php.ini:

[mail function]
SMTP = smtp.gmail.com
smtp_port = 587
sendmail_from = [email protected]
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 = [email protected]
auth_password = (my google app password)
force_sender = [email protected]
smtp_ssl=auto

我在任何地方都找不到该问题。任何想法可能是造成此问题的原因吗?

php symfony xampp localhost swiftmailer
1个回答
0
投票

我不知道解决您问题的方法,但我有同样的错误。我的环境文件中的字符无效。

也许再次检查您的设置?

© www.soinside.com 2019 - 2024. All rights reserved.