php - yii2 如何防止 swiftmailer 将电子邮件发送到垃圾邮件文件夹

标签 php yii2 swiftmailer spam

如何防止swiftmailer将邮件发送到垃圾邮件文件夹 我是这样使用它的:

        Yii::$app->mailer->compose()
          ->setFrom($sender_email)
          ->setTo($reciver)
          ->setSubject($subject)
          ->setTextBody($body)
          ->setHtmlBody($hml)
          ->send();

最佳答案

使用一些标题

Reference

$message = Yii::$app->mailer->compose(...);
$message->getSwiftMessage()->getHeaders()->addTextHeader('name', 'value');

另见 this

关于php - yii2 如何防止 swiftmailer 将电子邮件发送到垃圾邮件文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36588073/

相关文章:

PHP header - 内容类型 : image/jpeg - Not working for Internet Explorer

redis - 如何修复 yii2 中的 redis session 它确实登录了我的用户

php - yii2:Gridview 在表单 View 中的自定义分页

php - laravel 中 swiftmailer 的替代品

php - 如何将 Swiftmailer 集成到 Angular2 中

php - brew install php55-intl 失败,无法安装 Composer

PHP 与 MySQL Workbench : Same query, 不同的结果

php - 在 PHP 中使用 MySQL 查询

php - 强制 Yii 2 在 ActiveRecord 模型保存上使用准备好的语句

php - 通过 sendgrid 发送邮件