My email sending process involves using a template:
$content='Message';
Yii::$app->mailer->compose('@app/mail/templates/templ', ['content'=>$content])
->setFrom('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4a2d253825282f3e39642b39332b0a2d272b232664292527">[email protected]</a>')
->setTo('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="620c0311161b034c055056535222050f030b0e4c010d0f">[email protected]</a>')
->setSubject('Message subject')
->send();
Here is my template structure:
<?php
use yii\helpers\Html;
/* @var $this \yii\web\View view component instance */
/* @var $message \yii\mail\MessageInterface the message being composed */
/* @var $content string main view render result */
?>
<?php $this->beginPage() ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?= Yii::$app->charset ?>" />
<style type="text/css">
.footer {
color: red;
}
</style>
<?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>
<?= $content ?>
<div class="footer">With kind regards </div>
<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>
However, after checking my sent emails, I noticed that CSS classes are not applied, including the 'footer' class. Can anyone help me troubleshoot and fix this issue?