Quantcast
Channel: Active questions tagged email - Stack Overflow
Viewing all articles
Browse latest Browse all 29762

How can I fix my SSL error while I try to send a mail with symfony 5?

$
0
0

I'm currently trying to send emails with symfony 5 (should be the same as Symfony 4) through gmail but I can't send any. I tried to use the SwiftMailer component but it does nothing (tried tls and ssl). After that, I found that there was a mailer component in symfony (https://symfony.com/doc/current/components/mailer.html), I tried to setup it but this time I got the following error :

Connection could not be established with host "ssl://smtp.gmail.com:465": stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed.

I tried then to add a certificate to openssl in my php.ini but it doesn't work. I also tried the swiftmailer:email:send command and I got the following error :

Exception occurred while flushing email queue: Connection could not be established with host smtp.gmail.com :stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed

---- EDIT ----
It appear to work using the following configuration for the swiftmailer.yaml file and nothing in .env file :

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


Viewing all articles
Browse latest Browse all 29762

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>