How about these
$message[] = Yii::$app->mailer->compose('downNotify', [
'image' => Url::to('@app/web/mail/images/logo.png')
])
$message->setBody($message);
Or see here
Yii::$app->mailer->compose('embed-email', ['imageFileName' => '/path/to/image.jpg'])
->send();
<img src="<?= $message->embed($imageFileName); ?>">
Or see here
$uploadedFile = CUploadedFile::getInstance($model,'anexo'); $msg->attach($uploadedFile);
Or this too
$image = Swift_Image::fromPath(dirname(Yii::app()->getBasePath()) . '/images/someimage.jpg');
$cid = $message->embed($image);
$message->setBody(array('cid' => $cid), 'text/html');
So in protected /views/mail/test.php:
<b>An embedded inline image:</b><br><br>
<img src="<?php echo $cid; ?>" alt="WTF went wrong?" />
Or is it toooo ( Adding attachments )
Yii::setPathOfAlias('webroot.images.mail', '/path/to/your/images/mail/dir');
source
share