Warning: stream_socket_enable_crypto(): SSL context creation failure [Mailjet][Symfony5]

This is bothering me for hours now. I’m trying to send mails with Symfony 5 and SwiftMailerBundle 3.4 using Mailjet. So I have the following value in my .env file:

MAILER_URL=smtp://in-v3.mailjet.com:587?encryption=tls&auth_mode=login&username={USERNAME}&password={PASSWORD}

In production I used my username and password ofcourse.

Now when Symfony tries to send a mail I get the following error:

Warning: stream_socket_enable_crypto(): SSL context creation failure

The most annoying part is that these settings are working on my local machine, but not on my server. My server is a Ubuntu server, running PHP 7.3. Local environment is MacOS also with PHP 7.3.


So, I already tried to following:

stream_options:
  ssl:
    allow_self_signed: true
    verify_peer: false

Does somebody have an idea on how to fix this? I don’t want to waste another five hours on this on new years eve…

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *