How to use PHPMailer with yii2

Published on Author Code Father

Do with the below:

use [NAMESPACE]/PHPMailer;

at the top of your file.

Also Yii comes already with swiftmailer, if you do not want to use it you can always just install a new mailer

this ones come with phpmailer already in the package. It also comes with a cronjob because you do not really want to send emails directly, it takes too long usually.
https://packagist.org/packages/rmrevin/yii2-postman

this ones integrates better with yii as a component
http://www.yiiframework.com/extension/zyx-phpmailer/

I personally use Mailchimp as it makes sending emails easy and I do not care to debug a mailserver when things do not go ok or when you are put on spam lists.

Comments

comments

Categories Yii