0

我正在尝试使用MailSo库来创建 MIME 消息。我已经到了下一步是处理附件的地步。当附件是二进制文件时一切都很好,但是当我尝试添加纯文本附件时,如下所示

$rResource = "Some plain text goes here";
$sFileName = 'text.txt';
$iFileSize = \strlen("Some plain text goes here");
$bIsInline = false;
$bIsLinked = false;
$sCID = $metadataCID;
$aCustomContentTypeParams = array(\MailSo\Base\Enumerations\Encoding::QUOTED_PRINTABLE_LOWER);

$oMessage->Attachments()->Add(
    \MailSo\Mime\Attachment::NewInstance(
        $rResource,
        $sFileName,
        $iFileSize,
        $bIsInline,
        $bIsLinked,
        $sCID,
        $aCustomContentTypeParams
    )
);

我希望看到该附件

Content-Type: text/plain; charset="utf-8" 
Content-Transfer-Encoding: quoted-printable 
Content-Disposition: attachment; filename=text.txt 

但它总是强制base64既不将字符集添加到内容类型部分

Content-Type: text/plain; name="text.txt" 
Content-Disposition: attachment; filename="text.txt" 
Content-Transfer-Encoding: base64 

有什么建议吗?

4

1 回答 1

0

看起来 MailSo 库将所有​​附件message/rfc822视为二进制文件。它将需要重写或扩展createNewMessageAttachmentBody()私有函数。

于 2018-01-25T13:45:04.740 回答