Tuesday, April 24, 2018

Yii2 send attachment

Yii2 send attachment using swiftmailer

You can send attachment using swiftmailer using below method

Before send an attachment you need to set swiftmailer configuration:
Swiftmailer configuration

$mail = Yii::$app->mailer->compose();

// file path
$mail->attach('path/to/image.jpg');

$mail->send();

No comments:

Post a Comment

Recent Update

yii2 session handling

use yii\web\Session; $session = Yii::$app->session; // start session $session->open(); // close session $session->close(); ...

Most Search