Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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

After completing a form

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
478 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...