0
votes

When I want to send a email with command in terminal I get Swift_TransportException:

Expected response code 220 but got an empty response in AbstractSmtpTransport.php:445

I've created SendEmailController class in commands dir and method in that class:

public function actionSend() {            
    Yii::$app->mailer->compose()->setFrom('[email protected]')
    ->setTo('[email protected]')    
    ->setSubject('Test Subject from command')    
    ->setTextBody('Test Body')    
    ->send();                                        
}

I have the same method in the SiteController and when I call over the url, it works. What's the difference between command and url in this case? Did anyone have the same problem? Thanks !

1
Have you got the same mailer config in web and console? - Bizley
That's it, thank you! - darkod

1 Answers

1
votes

Check your console config, mailer settings must be same as in web config