How do we override mail view files of a 3rd party module/component?
Let's assume a module is using the following code to send an email:
Yii::$app->mailer->compose([
'html' => '@myvendor/mymodule/mail/email-html',
'text' => '@myvendor/mymodule/mail/email-text',
])
->setTo([$email => $name])
->setSubject('Hi');
->send();
How would we override these individual email views @myvendor/mymodule/mail/email-html
and @myvendor/mymodule/mail/email-text
?
You can override these two aliases in your config:
'aliases' => [
'@myvendor/mymodule/mail/email-html' => '@app/views/mail/email-html',
'@myvendor/mymodule/mail/email-text' => '@app/views/mail/email-text',
],