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

khaledw62's avatar

Symfony Mailer Issue After Upgrade

Exception:

using 465 and encryption=tls

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

using 2526 and encryption=null

Connection could not be established with host "imap.worldposta.com:2526": stream_socket_client(): Unable to connect to imap.worldposta.com:2526 (Connection refused)

the two combinations were recommended by the worldposta company

About App:

Laravel Version: 9.23.0
Php Version: 8.1.9

ENV Configuration:

MAIL_MAILER=smtp
MAIL_HOST=imap.worldposta.com
MAIL_PORT=2526
[email protected]
MAIL_PASSWORD=*******
MAIL_ENCRYPTION=
MAIL_FROM_NAME="Company Name"
[email protected]

Here is the issue ,the mailing is working fine onlocalhost but not in production.

this first happened when i upgraded Laravel 8 to 9 i've tried a lot of combinations and options like adding the next few lines in the mail config file

<?php
return [
		   ....
			'allow_self_signed' => true,
            'verify_peer' => false,
            'verify_peer_name' => false,
]
0 likes
23 replies
Sinnbeck's avatar

Is it a typo that you have two @ in the from address?

Sinnbeck's avatar

And are you sure you need to use the imap server? Imap is for incoming mail. It should be an smtp server

Sinnbeck's avatar

Can you try starttls?

MAIL_ENCRYPTION=starttls
MAIL_PORT=465
khaledw62's avatar

@Sinnbeck

Connection could not be established with host "ssl://imap.worldposta.com:465": stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages: error:1408F10B:SSL routines:ssl3_get_record:wrong version number
khaledw62's avatar

@sinnbeck timed out

Connection could not be established with host "imap.worldposta.com:587": stream_socket_client(): Unable to connect to imap.worldposta.com:587 (Connection timed out)
Sinnbeck's avatar

@khaledw62 hmm so only that other port is open. Then I cannot say currently. All suggestions I can find for that error is to switch to 587. Maybe test with a real transactional mail service like mailgun or mailpace?

Sinnbeck's avatar

Did some more reading. Could indicate that they are using old outdated tls

khaledw62's avatar

i've already tried something online called smtper and it worked, it's driving me crazy i even installed swiftMailer and tried to create the transport manual and it worked but with the new symfonyMailer it just doesn't work for some reason , i think there is a differance between the stream build process ,i don't know

Sinnbeck's avatar

@khaledw62 my guess is that symfony does not like the downgraded tls. The error message would make sense in this context (this is only based on what I can find other people with the error say)

Maybe you can ask them what tls versions they support?

Sinnbeck's avatar

@khaledw62 and there is no chance you can use a proper transactional email service? You even get webhook then :)

Sinnbeck's avatar

@khaledw62 Something is off with that server. I just tried connecting to it from the terminal

openssl s_client -connect imap.worldposta.com:465 -tls1_3 

No tls response

openssl s_client -connect smtp.mailgun.org:465 -tls1_3 

tls response

Sinnbeck's avatar

Maybe ask them if they can open 587 for smtp?

khaledw62's avatar

@Sinnbeck i did actually but the answer was they can not do that for some security reason

Sinnbeck's avatar

@khaledw62 hmm ok that sounds strange. I assume the reason to not use a transactional provider is due to cost?

khaledw62's avatar

@Sinnbeck actually worlposta kinda expensive 2.7 USD/User/Month for 50GB Mail Storage ,but we've just renewed our contract few months ago

Sinnbeck's avatar

@khaledw62 you don't need to quit it :) Its possible to use the same domain on both a regular mail service and transactional mail service at the same time. It's just a matter of setting up spf and dkim for the domain correctly (services like mailgun gives you the values to copy paste)

Anyways. My best suggestion otherwise would be to keep searching for "symfony ssl3_get_record:wrong version number" and hope for a hit

khaledw62's avatar

even the NTML encryption also gives the same error

khaledw62's avatar

@sinnbeck Hello recently i've been working on forge and digital ocean and i've tested this case and it was working ,is that means that i have an issue in my current server?

with the same configuration and host

MAIL_MAILER=smtp
MAIL_HOST=imap.worldposta.com
MAIL_PORT=2526
MAIL_USERNAME="[email protected]"
MAIL_PASSWORD="******"
MAIL_ENCRYPTION=STARTTLS
MAIL_FROM_NAME="My App"
[email protected]
MAIL_EHLO_DOMAIN="domain.com"

Please or to participate in this conversation.