Revision #5 has been created by Wade Shuler on Apr 15, 2019, 2:58:32 AM with the memo:
The component is mailer, not mail
« previous (#4)
Changes
Title
unchanged
How to send emails using SMTP
Category
unchanged
How-tos
Yii version
unchanged
2.0
Tags
unchanged
mail,email,yii2,mailer,smtp
Content
changed
[...]
------------------
Use this code for sending emails from your application:
```php
Yii::$app->mailer->compose()
->setFrom('somebody@domain.com')
->setTo('myemail@yourserver.com')[...]
```php
Yii::$app->mailer->compose('@app/mail-templates/email01', [/*Some params for the view */])
->setFrom('from@domain.com')
->setTo('someemail@server.com')[...]
```php
Yii::$app->mailer->compose(['html' => '@app/mail-templates/html-email-01', 'text' => '@app/mail-templates/text-email-01'], [/*Some params for the view */])
->setFrom('from@domain.com')
->setTo('someemail@server.com')
->setSubject('Advanced email from Yii2-SwiftMailer')
->send();
```[...]