【问题标题】:PHP Symfony Swift_Mailer error: # unable to fetch the response from the backend: malformed MIME header: missing colon: %!!(MISSING)q(MISSING)#5 {main}PHP Symfony Swift_Mailer 错误:# 无法从后端获取响应:格式错误的 MIME 标头:缺少冒号:%!!(MISSING)q(MISSING)#5 {main}
【发布时间】: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


    【解决方案1】:

    我遇到了类似的问题,更新 symfony 的全球版本解决了这个问题。只需运行 symfony self-update 并确保一切都是最新的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-14
      • 2018-04-25
      • 2020-09-17
      • 1970-01-01
      • 1970-01-01
      • 2020-05-12
      • 2021-08-30
      相关资源
      最近更新 更多