Yii2 SwiftMailer sending email via remote smtp server (gmail)
问题 I want to send emails via my gmail account. My mailer config: [ 'class' => 'yii\swiftmailer\Mailer', 'useFileTransport' => false,//set this property to false to send mails to real email addresses 'transport' => [ 'class' => 'Swift_SmtpTransport', 'host' => 'smtp.gmail.com', 'username' => 'my@gmail.com', 'password' => 'pass', 'port' => '587', 'encryption' => 'tls', ], ] I wrote command MailController: <?php namespace app\commands; use yii\console\Controller; use Yii; /** * Sanding mail * Class