Symfony 4 SwiftMailer Gmail:未发送电子邮件 [英] Symfony 4 SwiftMailer Gmail : Email not sent

查看:1274
本文介绍了Symfony 4 SwiftMailer Gmail:未发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在开发一个Symfony 4应用程序,我需要通过Swift Mailer发送电子邮件。
当我发送电子邮件时,我会收到邮件假发,但我没有收到我的Gmail邮箱。
我在我的Gmail配置中允许不安全的应用程序。



这是我的.env文件的邮件程序URL:MAILER_URL = gmail:// ep **** @ gmail.com:PASSWORD@localhost



这是我的swiftmailer.yaml:

  $ b $ sw 
$ sw


$ b $ {
$ {
$ { code>

这是我的控制器函数:

src / Controller / AccountController。 php





这是我的文档其次:
http://symfony.com/doc/current/email.html



我检查了这些问题,但他们没有给我答案:在Windows 10上运行的机器? mailer symfony 4无法正常工作 a>



请,我需要帮助。我一整天都在寻找解决方案。我没有收到任何错误,但我没有收到邮件。
提前致谢。任何链接都可以帮助我。

解决方案

问题解决了!
放置这个配置,而不是使用URL env变量

$ $ $ $ $ $ $ $ $ $ $ $ $ swiftmailer:
transport:gmail
用户名:****@gmail.com
密码:*******
主机:localhost
端口:465
加密:ssl
auth -mode:login
spool:{type:'memory'}
stream_options:
ssl:
allow_self_signed:true
verify_peer:false
verify_peer_name:false


I'm currently working on a Symfony 4 application and I need to send emails throught Swift Mailer. When I send an email, I receive the email spooled but I don't get it in my Gmail Mailbox. I allowed unsecure apps in my gmail configuration.

This is my mailer URL from .env file : MAILER_URL=gmail://ep****@gmail.com:PASSWORD@localhost

This is my swiftmailer.yaml:

    #config/packages/swiftmailer.yaml
    swiftmailer:
        url: '%env(MAILER_URL)%'
        spool: { type: 'memory' }

This is my controller function:

src/Controller/AccountController.php

This is the documentation I've followed : http://symfony.com/doc/current/email.html

I've checked these questions but they don't give me the answer : How to send emails with Symfony 4 Swiftmailer from a local machine running on Windows 10? , mailer symfony 4 not working

Please, I need help. I've looked for the solution all day long. I get no errors but I don't receive the mail. Thanks in advance. Any link can help me.

解决方案

Problem solved!! Put this configuration instead of using the URL env variable

swiftmailer:
    transport:        gmail
    username:         ****@gmail.com
    password:         *******
    host:             localhost
    port:             465
    encryption:       ssl
    auth-mode:        login
    spool: { type: 'memory' }
    stream_options:
        ssl:
            allow_self_signed: true
            verify_peer: false
            verify_peer_name: false

这篇关于Symfony 4 SwiftMailer Gmail:未发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆