dongzhang5787 2013-05-10 16:27
浏览 63

如何使用php生成outlook msg文件[关闭]

i'm trying generate msg file with php. Headers;

header("Pragma: public");
header("Expires: 0");
header('Content-Encoding: UTF-8');
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Content-type: application/vnd.ms-outlook;charset=UTF-8"); 
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");;
header("Content-Disposition: attachment;filename=test.msg");
header("Content-Transfer-Encoding: binary ");

But i'm getting an error message when open

File content:

Date: Fri, 10 May 2013 19:17:49 +0300
Return-Path: xxxx@domain.com
To: xxxx@domain.com
From: =?UTF-8?Q?T=C3=BCxxx_xxx?= <xxxx@domain.com>
Reply-To: =?UTF-8?Q?T=C3=BCxxx_xxx?= <xxxxx@domain.com>
Subject: =?UTF-8?B?ZmFsc2U=?=
Message-ID: <838dbc263c534dc099336c468b254365@example.com>
X-Priority: 3
X-Mailer: PHPMailer 5.2.2 (http://code.google.com/a/apache-extras.org/p/phpmailer/)
MIME-Version: 1.0
Content-Type: multipart/alternative;
    boundary="b1_838dbc263c534dc099336c468b254365"


--b1_838dbc263c534dc099336c468b254365
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

test

--b1_838dbc263c534dc099336c468b254365
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body rightmargin="0" leftmargin="0" bottommargin="0" topmargin="0" marginwidth="0" marginheight="0">
test
</body>
</html>

--b1_838dbc263c534dc099336c468b254365--
  • 写回答

1条回答 默认 最新

  • dongtao9887 2013-05-10 16:48
    关注

    This is not an MSG file, this is an EML (MIME) file. MSG file is as binary as it gets - it is an OLE storage (IStorage) file.

    You can either create the MSG file explicitly (its format is documented) or use a third party library, such as Redemption (use RDOSession.CreateMessageFromMsgFile).

    评论

报告相同问题?

悬赏问题

  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?
  • ¥15 乘性高斯噪声在深度学习网络中的应用
  • ¥15 运筹学排序问题中的在线排序
  • ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败