Difference between #4 and #5 of
How to send emails using SMTP

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->mail
er->compose()
->setFrom('somebody@domain.com')
->setTo('myemail@yourserver.com')
[...]
```php
Yii::$app->mail
er->compose('@app/mail-templates/email01', [/*Some params for the view */])
->setFrom('from@domain.com')
->setTo('someemail@server.com')
[...]
```php
Yii::$app->mail
er->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();
```
[...]
6 0
11 followers
Viewed: 137 775 times
Version: 2.0
Category: How-tos
Written by: robregonm
Last updated by: Wade Shuler
Created on: Apr 29, 2014
Last updated: 5 years ago
Update Article

Revisions

View all history