yiisoft / yii2-symfonymailer

Yii 2 Symfony mailer extension.
https://www.yiiframework.com/
BSD 3-Clause "New" or "Revised" License
42 stars 22 forks source link

cannot send email #57

Closed ghpeppe closed 1 year ago

ghpeppe commented 1 year ago

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

rhertogh commented 1 year ago

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

ghpeppe commented 1 year ago

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.

samdark commented 1 year ago

It is a bit different from Swiftmailer config-wise: https://github.com/symfony/symfony/issues/34846

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