Search code examples
phpsymfonysslswiftmailer

Error message: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed


When i try to send a mail with swiftmailer and symfony, i have this error.

stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

I updated the cacert.pem with the mozilla cacert.pem file of 2020-05-20. But that change nothing, i have no idea to correct this.

You will find my code below for the configuration of Switfmailer :

swiftmailer:
    default-mailer: mailer
    mailers:
        mailer:
            transport: "%mailer_transport%"
            host:      "%mailer_host%"
            username:  "%mailer_user%"
            password:  "%mailer_password%"
            encryption : "%mailer_encryption%"
            port: "%mailer_port%"
            auth_mode: "%mailer_auth%"
            spool:     { type: memory }
            stream_options:
                ssl:
                    allow_self_signed: true
                    verify_peer: false
                    verify_peer_name: false

Have one more info, when i have an error on my code, that send an email to me and that's good, i receive the email. For info, i use monologBundle.

swift:
        type: swift_mailer
        from_email: 'noreply@******'
        to_email:   '%mailer_alert_prod%'
        # or list of recipients
        # to_email:   ['dev1@example.com', 'dev2@example.com', ...]
        subject:    'An Error Occurred! %%message%%'
        level:      critical
        formatter:  monolog.formatter.html
        content_type: text/html
        mailer : mailer

It's really strange.

Thanks a lot


Solution

  • Well, i find something, the option, i add on my config.yml wasn't loaded at the initialision on the swiftmailer module. i added it directly on the swiftmailer code and that's work. I will open an issue on swiftmailer. Thanks for the help