无法从测试网站yii2 swiftmailer发送邮件

问题描述 投票:-1回答:1

我的服务器是基于linux的。请帮我正确的邮件配置

'mailer' => [
            'class'            => 'yii\swiftmailer\Mailer',
            'viewPath'         => '@common/mail',

            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => false,
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.gmail.com',
                'port' => '465',
                'encryption' => 'ssl',              
            ],
        ],
linux yii2 swiftmailer
1个回答
0
投票

对于gmail应该是端口587加密tls

        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => 'smtp.gmail.com',
            'username' => '[email protected]',
            'password' => 'yourpassword',
            'port' => '587',
            'encryption' => 'tls',
        ],
© www.soinside.com 2019 - 2024. All rights reserved.