Search code examples
symfonysmtpoffice365mailer

Trying to send mail using Symfony Mailer with Office365 but keep getting SSL operation failed with code 1


I'm trying to get the mailer component of Symfony 5.0.0 to work with Office 365.

I can get it working in SwiftMailer using

MAILER_URL=smtp://smtp.office365.com:587?encryption=tls&auth_mode=login&username=#####&password=####

But when I try to use mailer with

MAILER_DSN=smtps://#####:######@smtp.office365.com:587

I get the following error

Connection could not be established with host "ssl://smtp.office365.com:587": stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number.

If I try with just SMTP I get

Connection to "smtp.office365.com:587" timed out.


Solution

  • The solution I found for now was this. Issue Github