Problem with Swiftmailer

Emails are not sent with ->setFrom(‘’)

i have:

'mailer' => [

            'class' => 'yii\swiftmailer\Mailer',

            'viewPath' => '@common/mail',

            'useFileTransport' => false,


  public function sendEmail($email)


        return Yii::$app->mailer->compose(

                ['html' => 'contact-html', 'text' => 'contact-text'],

                ['model' => $this]








if i delete row ->setFrom(‘’) all works good.

What is that?

May be your server has no permission to send mails from domain "" ?

I think that for production usage it’s better to use SMTP:

function mail() works good, and i tried any emails, how can i detect access?