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.

this ones integrates better with yii as a component

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.



Categories Yii