我使用 Mailer 发送电子邮件,所以我对发件人姓名有疑问
这是我的配置
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'messageConfig' => [
'charset' => 'UTF-8',
'from' => ['[email protected] /cdn-cgi/l/email-protection' => 'App Sender Name'],
],
'transport' => [
'class' => 'Swift_MailTransport',
],
],
So it's not work. I goto inbox and only email showed.
And i need show as
Example:
当我更新 setFrom() 方法时它就起作用了。
例如: $mailer->setFrom(['[电子邮件受保护] /cdn-cgi/l/email-protection' => '应用程序名称'])。这是通过 PHP 邮件发送并带有发件人姓名的配置 Yii2
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'useFileTransport' => false,
'messageConfig' => [
'charset' => 'UTF-8',
'from' => ['[email protected] /cdn-cgi/l/email-protection' => 'App Sender Name'],
],
'transport' => [
'class' => 'Swift_MailTransport',
],
],
并发送电子邮件
Yii::$app->mailer->compose()
->setTo('[email protected] /cdn-cgi/l/email-protection')
->setFrom(['[email protected] /cdn-cgi/l/email-protection' => 'App Name'])
....
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)