0

PHPでmsgファイルを生成しようとしています。ヘッダー;

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 ");

しかし、開いたときにエラーメッセージが表示されます

ファイルの内容:

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--
4

1 に答える 1

1

これは MSG ファイルではなく、EML (MIME) ファイルです。MSG ファイルはバイナリ形式であり、OLE ストレージ (IStorage) ファイルです。

MSG ファイルを明示的に作成するか (その形式は文書化されています)、 Redemptionなどのサード パーティ ライブラリを使用できます ( RDOSession .CreateMessageFromMsgFile を使用します)。

于 2013-05-10T16:48:26.470 に答える