用PHP编译带有多个附件的电子邮件 [英] Compiling email with multiple attachments in PHP
问题描述
我需要从PHP发送带有多个图像附件的电子邮件.我目前有一个使用两个硬编码图像的测试设置.我用所有必要的标题编译电子邮件并将其发送出去.但是,当我收到它时,它仅将第一张图像显示为附件.第二张图片似乎被忽略了(已通过Groupwise和Gmail进行了测试).
I need to send out an email with multiple image attachments from PHP. I currently have a test set up that uses two hard coded images. I compile the email with al the necessary headers and send it out. However, when I receive it, it only shows the first image as an attachment. The second image seems to be ignored (tested with both Groupwise and Gmail).
当我查看电子邮件的来源时,以下是服务器生成的标头之后的内容.显然,两个附件(图像)都在其中,但只有第一个附件显示为附件.
When I view the source of my email the following is what I see after the by the server generated headers. Apparently both attachments (images) are in there but only the first one is showing up as an attachment.
任何帮助将不胜感激.
This is a multi-part message in MIME format.
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
my message text
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x
Content-Type: image/gif;
name="image1.gif"
Content-Disposition: attachment;
filename="image1.gif"
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAABEAAAAMCAIAAAALR8HoAAABgElEQVQoFZWQzSuEURTG7z3n3Pt+
*[-- snip --]*
SaHPETExQ6HQ0BB4Z8FwTr/KHVc/AJ98jIf2BGdKAAAAAElFTkSuQmCC
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x--
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x
Content-Type: image/gif;
name="image2.gif"
Content-Disposition: attachment;
filename="image2.gif"
Content-Transfer-Encoding: base64
iVBORw0KGgoAAAANSUhEUgAAAKMAAAAyCAIAAAC/NPwxAAAAA3NCSVQICAjb4U/gAAAACXBIWXMA
*[-- snip --]*
yh4+kv39P/vticlfC0Muodov+5posktKGGb7/2pscsAoKykp2W8fTH4Exv1tEEbD3NNGwbi/y8do
mNnbKPwf2Oju7uv54J4AAAAASUVORK5CYII=
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x--
推荐答案
从内存中获取:
SaHPETExQ6HQ0BB4Z8FwTr/KHVc/AJ98jIf2BGdKAAAAAElFTkSuQmCC
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x--
^^^ DELETE THIS LINE ^^^
--==Multipart_Boundary_x38e1b83d34375e183a2fdcd6a9c001f8x
您不应有两个相邻的边界,结尾处的-"仅用于最后部分的结尾.
You shouldn't have two boundaries next to each other, and the "--" at the end is only for the end of the last part.
这篇关于用PHP编译带有多个附件的电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!