K
K
Konstantin Marchenko2018-06-06 16:15:21
Yii
Konstantin Marchenko, 2018-06-06 16:15:21

Yii2 sending mail via swiftmailer?

Hello! Installed yii2 advanced today. Everything is fine, but does not want to send letters to the mail. I know that I need to set false y useFileTransport in the config:

'components' => [
        'db' => [
            .....
        ],
        '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            
        ],
    ],

It is also necessary to disable debug, which I did myself:
defined('YII_DEBUG') or define('YII_DEBUG', false);
//defined('YII_ENV') or define('YII_ENV', 'dev');

and
/*if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];
}*/

But still does not want to send and that's it. I sit for half a day and I can not understand what is the reason. I sinned that mail () does not work on the server. I checked it right through it, successfully went and got it. But he doesn't want to use swiftmailer and that's it. The letters themselves are sent, but they are sent locally to the /frontend/runtime/debug/mail folder.
I installed the project itself via git clone and then did a php composer.phar update. But before installing, I had a backup of this project and started looking at the files in the /vendor/swiftmailer/swiftmailer/lib/classes folder and comparing them with those that were downloaded via update. And I noticed that there are no files, and some are new. That is, it looks like an update by the developers. But I can't figure out if they screwed up something or am I doing something wrong?!

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question