Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ashoor's avatar

Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate CN=`xxx' did not match expected CN=`smtp.sendgrid.net'

Hi,

sending emails works successfully for hours then next day i tried it and didn't send and got this error

Symfony\Component\Mailer\Exception\TransportException: Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate CN=`xxx' did not match expected CN=`smtp.sendgrid.net'

why in the first sent and stopped without changing config!

i read about disabling smtp restriction by whm but I'm using cpanel and I didn't find "tweak setting"

can you help ?

thanks

1 like
4 replies
bobbybouwmann's avatar

I believe there is a configuration called "SMTP Restrictions". You need to disable that.

2 likes
GodziLaravel's avatar

Hi did you solved this problem because I have it too

 Unable to connect with STARTTLS: stream_socket_enable_crypto(): Peer certificate CN=`vagrant' did not match expected CN=`localhost'.
Ghrix's avatar

Make sure your outgoing SMTP is allowed to non root, exim, and mailman as well

INTO WHM you can do > SMTP > Tweak Settings > Mail > Restrict outgoing SMTP to root, exim, and mailman (FKA SMTP Tweak) [?] > set off

2 likes

Please or to participate in this conversation.