簡體   English   中英

PHP Symfony Swift_Mailer 錯誤:#無法從后端獲取響應:格式錯誤的 MIME header:缺少冒號:%q!!(

[英]PHP Symfony Swift_Mailer error: # unable to fetch the response from the backend: malformed MIME header: missing colon: %!!(MISSING)q(MISSING)#5 {main}

我剛剛開始在 Symfony5 中使用 Swiftmailer。 問題是,當我在 localhost 服務器上使用 Symfony 運行它以發送 email 時,它會拋出上述錯誤。

                $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

發送郵件.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

我在任何地方都找不到那個問題。 有什么想法可能是這個問題的原因嗎?

我遇到了類似的問題,更新 symfony 的全局版本解決了這個問題。 只需運行symfony self-update並確保一切都是最新的。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM