PHP MailSo 库和附件

PHP MailSo library and attachments

我正在尝试使用 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 

有什么建议吗?

MailSo 库似乎将 message/rfc822 以外的所有附件都视为二进制文件。它将需要重写或扩展 createNewMessageAttachmentBody() 私有函数。