【问题标题】:how to change the content-transfer encoding to 8 bit mime in swiftmailer?如何在 swiftmailer 中将内容传输编码更改为 8 位 mime?
【发布时间】:2016-11-11 10:04:34
【问题描述】:

为了避免垃圾邮件,以下是来自 zoho 的说明

Until then please change the content-transfer encoding so as to avoid 8 bit mime to prevent DKIM signatures from failing. 

如何使用 Swiftmailer 或 yii2 邮件程序更改内容传输编码?

【问题讨论】:

    标签: yii2 phpmailer swiftmailer


    【解决方案1】:

    如果我理解正确,你想避免 8 位编码而不是设置它?

    您可以为 SwiftMailer 消息设置编码器,例如:

    $message->setEncoder(
        new \Swift_Mime_ContentEncoder_PlainContentEncoder('7bit')
    );
    

    我不确定如何使用 Yii 2 扩展来做到这一点。您可以尝试以下方法:

    $message = Yii::$app->mailer->compose()
        ->setFrom('...')
        ->setTo('...')
        ->setSubject('...');
    
    $message->getSwiftMessage()->setEncoder(
        new \Swift_Mime_ContentEncoder_PlainContentEncoder('7bit')
    );
    
    $message->send();
    

    【讨论】:

      【解决方案2】:

      尝试使用它而不是普通内容编码器

      $message->setEncoder(Swift_Encoding::get8BitEncoding());
      

      【讨论】:

      • 注意:从 SwiftMailer ^6.0 开始,Swift_Encoding 类已被删除source
      猜你喜欢
      • 2023-02-15
      • 1970-01-01
      • 1970-01-01
      • 2012-07-28
      • 2019-10-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-21
      相关资源
      最近更新 更多