doutui7955 2009-04-06 07:15
浏览 77
已采纳

使用PHP编译具有多个附件的电子邮件

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.

Any help would be greatly appreciated.

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--
  • 写回答

3条回答 默认 最新

  • douzhen9428 2009-04-06 07:37
    关注

    Going from memory:

    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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测