The module for yii2 which allows mail sending. Work up to swiftmail.
-
To the project file
composer.jsonadd to therequiresection:"idfly/yii2-shell-task-ui": "dev-master" -
To the
repositoriessection:{ "type": "git", "url": "git@bitbucket.org:idfly/yii2-shell-task-ui.git" } -
Run
composer update -
Place to the project's configuration file:
$config['components']['mail'] = [
'class' => 'idfly\mailerBridge\Mail',
'mailerFrom' => 'noreply@yoursite.com',
'useFileTransport' => false,
];
Call the function send() of mail-component. Set the mail-text as a first
argument, the second argument is options array.
Yii::$app->mail->send(
Yii::$app->view->render('@app/mail/case/recommend', [
'case' => $this,
'user' => $user,
]), [
'to' => $recipientEmail,
'subject' => $subject,
]
);