PHPMailer附件显示为base64编码的文本 [英] PHPMailer attachments are showing up as base64-encoded text
本文介绍了PHPMailer附件显示为base64编码的文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的PHP代码:
$mail = new PHPMailer();
$mail->AddAddress('neubert@neubert.com');
$mail->SetFrom('neubert@neubert.com');
$mail->Subject = 'Attachment Test ' . mt_rand(1, 10000000);
$mail->Body = 'See attached!';
$mail->AddStringAttachment('hello, world!', 'test.txt', 'base64', 'application/csv');
$mail->Send();
这是我的Gmail收件箱中的样子:
Here's what it looks like in my Gmail inbox:
这就是我想要的样子:
这是我在Gmail中单击显示原始图片"时看到的内容:
Here's what I see when I click on "Show original" in Gmail:
Content-Type: multipart/alternative; boundary="_av-HS21mQOZlMv59VDZAuEczg"
--_av-HS21mQOZlMv59VDZAuEczg
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit
This is a multi-part message in MIME format.
--b1_sXvhvmroccaUM1u8XDL1OMveVh8ZiFheK8opqb2i3o8 Content-Type: text/plain;
charset=us-ascii See attached!
--b1_sXvhvmroccaUM1u8XDL1OMveVh8ZiFheK8opqb2i3o8 Content-Type:
application/csv; name="test.txt" Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=test.txt aGVsbG8sIHdvcmxkIQ==
--b1_sXvhvmroccaUM1u8XDL1OMveVh8ZiFheK8opqb2i3o8--
--_av-HS21mQOZlMv59VDZAuEczg
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
This is a multi-part message in MIME format.
--b1_sXvhvmroccaUM1u8XDL1OMveVh8ZiFheK8opqb2i3o8
Content-Type: text/plain; charset=us-ascii
See attached!
--b1_sXvhvmroccaUM1u8XDL1OMveVh8ZiFheK8opqb2i3o8
Content-Type: application/csv; name="test.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename=test.txt
aGVsbG8sIHdvcmxkIQ==
--b1_sXvhvmroccaUM1u8XDL1OMveVh8ZiFheK8opqb2i3o8--<img src="https://mandrillapp.com/track/open.php?u=30776766&id=8ee95f6ae4b345d2a87af6f4ea043ca2" height="1" width="1">
--_av-HS21mQOZlMv59VDZAuEczg--
根据composer.lock,我正在使用v6.0.5.
According to composer.lock I'm using v6.0.5.
有什么想法吗?
推荐答案
我知道可能是什么原因-PHPMailer的MIME边界总是 以b1
,b2
,_av
开头的,因此我怀疑您有一些防病毒软件会干扰您的访问量.
I have an idea what might be causing this - PHPMailer's MIME boundaries always start with b1
, b2
, b3
- but yours starts with _av
, so I suspect that you have some anti-virus software interfering with your traffic.
这篇关于PHPMailer附件显示为base64编码的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文