我正在尝试使用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(MailSoBaseEnumerationsEncoding::QUOTED_PRINTABLE_LOWER);
$oMessage->Attachments()->Add(
MailSoMimeAttachment::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()
私有函数。