是否可以通过PHPmailer为代码添加/更新边界标头
$mail->addStringAttachment($test, 'test.txt', 'quoted-printable');
我需要添加/更新
--b1_KyZbvbrSl55hdWoQf7uUOwdfF2oGjqnCyP6rqNmlA
Content-Type: text/plain; name="test.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=test.txt看上去像
--b1_KyZbvbrSl55hdWoQf7uUOwdfF2oGjqnCyP6rqNmlA
Content-Type: text/plain; name="test.txt"; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=test.txt
Content-ID: 20cca107-2625-49ce-9357-95254a59147f@127.0.0.1因此,对于Content-Type头,添加了charset参数,然后添加了新的标头Content-ID。
对此有什么建议吗?
发布于 2018-01-26 18:56:02
经过进一步的调查,发现
addStringEmbeddedImage方法允许您为附件设置cid,该附件将为您设置标题。您可以忽略方法名称中的“图像”--它不关心您真正附加的内容类型。
所以在我的情况下
$mail->addStringEmbeddedImage(file_get_contents($file_name, FILE_USE_INCLUDE_PATH), $uuid, $file_name, 'base64', '', 'attachment');
将charset参数添加到Content-Type边界标头
引号-可打印的传输编码是ASCII 7位安全的,所以默认将工作良好,它不需要额外的字符集子句。
发布于 2018-01-26 16:52:16
用于传输编码和字符集。
$mail->Encoding = 'quoted-printable';
$mail->CharSet = 'UTF-8';对于内容id,请检查addEmbeddedImage方法或尝试直接添加标题,如下所示:
$mail->addCustomHeader('Content-ID', '20cca107-2625-49ce-9357-95254a59147f@127.0.0.1');https://stackoverflow.com/questions/48465701
复制相似问题