I am currently not receiving emails using the configuration below, and wondered if this is related to my setup, maybe something is missing or does not work on the local MAMP host?
main-local.php in the shared configuration directory
'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' => true, ],
And then send an email (which displays a success message)
public function submitreview($email) { //return Yii::$app->mailer->compose(['html' => '@app/mail-templates/submitreview']) return Yii::$app->mailer->compose() ->setTo($email) ->setFrom([$this->email => $this->name]) ->setSubject($this->title) ->setTextBody($this->description) ->attachContent($this->file) ->send(); }
source share