yiisoft/yii2-symfonymailer

cannot send email

ghpeppe opened this issue · 3 comments

Hi, I'm migrating from swiftmail to symfonymail.
This is the configuration:

        'mailer' => [
            'class' => \yii\symfonymailer\Mailer::class,
            'useFileTransport' => false,
            'messageClass' => 'app\components\MiaMessage',
            'transport' => [
                'scheme' => 'smtps',
                'host' => 'smtps.xxxx.xx',
                'username' => 'aaaaa',
                'password' => 'bbbbb',
                'port' => 25,
                'options' => [
                    'verify_peer' => 0,
                ],
            ],
            'viewPath' => '@app/mail',
        ],

When executing the “send” command, this is the error shown:

Symfony\Component\Mailer\Exception\TransportException
Connection could not be established with host "ssl://smtps.xxxx.xx:25": stream_socket_client(): SSL operation failed with code 1. OpenSSL Error messages:
error:1408F10B:SSL routines:ssl3_get_record:wrong version number

I can’t find any solution. Can someone helps me?
Thanks

[EDIT]
Suppressing the customized class MiaMessage and using the standard one, the behavior is the same.


Yii 2.0.48
yii2-symfonymailer 3.0.0
PHP 7.3.x

Are you sure you should be using port 25? smtps often uses port 587.

Are you sure you should be using port 25? smtps often uses port 587.

Yes. Parameters by our system admin.
And it worked for years with swiftmail.

It is a bit different from Swiftmailer config-wise: symfony/symfony#34846

So encryption type should be set explicitly as tls or smtps (for port 465).