1

есть встроенный swiftmailer но чую та еще дичь.

в \config\web.php

    'mailer' => [
        'class' => 'yii\swiftmailer\Mailer',
        // 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' => true,
        'transport' => [
            'class' => 'Swift_SmtpTransport',
            'host' => '*****', // e.g. smtp.mandrillapp.com or smtp.gmail.com
            'username' => '',
            'password' => '',
            'port' => 25, // Port 25 is a very common port too
        //   'encryption' => 'tls', // It is often used, check your provider or mail server specs
        ],
    ],

пытаюсь отправить views\site\index.php

    use yii\swiftmailer\Mailer;
    /* @var $this yii\web\View */

    $this->title = 'My Yii Application';
    Yii::$app->mailer->compose()
         ->setFrom('[email protected]')
         ->setTo('***@gmail.com')
         ->setSubject('dsfdfsdf')
         ->send();

не ошибки, ни письма

1 ответ 1

1

'useFileTransport' => true. Ваше письмо лежит в файле в папке runtime/mail. Измените значение на false и не забудьте указать правильные порты для SMTP-сервера.

2
  • у меня и папки такой нет. i.imgur.com/5NbDWSa.png её создать надо?
    – des1roer
    18 мар 2016 в 10:36
  • @des1roer нет, она должна создаваться автоматически 18 мар 2016 в 12:41

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.