Last active
May 11, 2018 12:50
-
-
Save kishor10d/b381dee484d9b9242fd52aa1d68f0ab7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static function emailTemplate($viewName = '', $toEmail = '', $subject = '', $dataToSend = array()) | |
{ | |
$from = \Yii::$app->params['FROM_EMAIL']; | |
$bcc_email = \Yii::$app->params['BCC_EMAIL']; | |
\Yii::$app->mailer->compose($viewName, $dataToSend) | |
->setFrom($from) | |
->setTo($toEmail) | |
->setBcc($bcc_email) | |
->setSubject($subject) | |
->send(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'mailer' => [ | |
'class' => 'yii\swiftmailer\Mailer', | |
'viewPath' => '@common/mail', | |
'transport' => [ | |
'class' => 'Swift_SmtpTransport', | |
'host' => 'smtp.gmail.com', // e.g. smtp.mandrillapp.com or smtp.gmail.com | |
'username' => '[email protected]', // my email id | |
'password' => 'xxxxxxxxx', // my password | |
'port' => '465', // Port 25 is a very common port too | |
'encryption' => 'ssl', // It is often used, check your provider or mail server specs | |
], | |
], | |
] | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment