有没有人解析过*.eml文件用的什么方法,谈点经验!!小弟十分着急谢谢 有没有人解析过*.eml文件用的什么方法,谈点经验!!小弟十分着急谢谢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try this#include "mapidefs.h"#include "imessage.h"#include "MAPIUTIL.H"#pragma comment(lib,"mapi32")...LPSTORAGE pStorage = NULL;HRESULT hr = StgOpenStorage (L"c:\\test.eml", NULL, STGM_TRANSACTED | STGM_READWRITE | STGM_SHARE_EXCLUSIVE, NULL, 0, &pStorage);LPMESSAGE pMessage = NULL;LPMALLOC pMalloc = MAPIGetDefaultMalloc();hr = OpenIMsgOnIStg (NULL, MAPIAllocateBuffer, MAPIAllocateMore, MAPIFreeBuffer, pMalloc, NULL, pStorage, NULL, 0, 0, &pMessage); 然后呢 比如说我怎么得到From,To,Subject等信息呢?? #import <cdosys.dll> no_namespace raw_interfaces_only#import "c:\program files\common files\system\ado\msado15.dll" no_namespace raw_interfaces_only#include "cdosysstr.h"#include "cdosyserr.h"#include <comdef.h>...IMessagePtr Load_Message_from_File(_bstr_t path){ /* ** This example shows a common use of the ADO Stream ** object with CDO, namely, opening a serialized ** message from a file on disk and loading it into ** a CDO Message object. **/ _StreamPtr pStm(__uuidof(Stream)); _variant_t varOptional(DISP_E_PARAMNOTFOUND,VT_ERROR); try { pStm->Open( // pStm->raw_Open( varOptional, adModeUnknown, adOpenStreamUnspecified, NULL, NULL); pStm->LoadFromFile(path); } catch(_com_error e) { throw e; } IMessagePtr iMsg(__uuidof(Message)); IDataSourcePtr iDsrc; iDsrc = iMsg; try { iDsrc->OpenObject(pStm,_bstr_t("_Stream")); } catch(_com_error e) { throw e; } return iMsg;}void GetFrom(){ IMessagePtr imsgptr=Load_Message_from_File("c:\\test.eml"); BSTR bsfrom; imsgptr->get_From(&bsfrom); _bstr_t bfrom(bsfrom); AfxMessageBox(bfrom);} 正文段通常是类似html格式的文档,怎么处理呢? look up HRESULT IMessage::get_BodyPart(IBodyPart** pVal); IBodyPart InterfaceThe IBodyPart interface defines a set of methods and properties used to manipulate message body parts. 为什么我的msdn上面找不到从文件里得到信息的例子和说明(都是怎样存储成文件的)你的就有呢? which version do you use? mine is 2001 Oct.not all codes are found in MSDN, some of them is written by myself:) 不行,我在98下这些文件都import不进来! 在一个单文档程序中,如何改变工具栏的背景色? 关于浏览器缓存的原理问题 COM接口传递图片的问题 vc6的pRecordset如何获得所有字段的名称和数据类型? [菜鸟问题]文件归类后出现的问题 高分急问:wmpsdk小问题 哪位大侠可以提供/sys/socket.h源文件 急!!!!!!!!!!!!!!!!!!!!! 为什么使用windows 的画图工具 将24位色的图片转化为256色的图象失真那么大? MySQL client ran out of memory.应该如何让解决? VC++和java起头并进可以吗? CEdit疑问
#include "mapidefs.h"
#include "imessage.h"
#include "MAPIUTIL.H"
#pragma comment(lib,"mapi32")
...
LPSTORAGE pStorage = NULL;
HRESULT hr = StgOpenStorage (L"c:\\test.eml", NULL,
STGM_TRANSACTED |
STGM_READWRITE |
STGM_SHARE_EXCLUSIVE,
NULL, 0, &pStorage);
LPMESSAGE pMessage = NULL;
LPMALLOC pMalloc = MAPIGetDefaultMalloc();
hr = OpenIMsgOnIStg (NULL, MAPIAllocateBuffer, MAPIAllocateMore,
MAPIFreeBuffer, pMalloc, NULL, pStorage,
NULL, 0, 0, &pMessage);
比如说我怎么得到From,To,Subject等信息呢??
#import "c:\program files\common files\system\ado\msado15.dll" no_namespace raw_interfaces_only
#include "cdosysstr.h"
#include "cdosyserr.h"
#include <comdef.h>
...
IMessagePtr Load_Message_from_File(_bstr_t path)
{
/*
** This example shows a common use of the ADO Stream
** object with CDO, namely, opening a serialized
** message from a file on disk and loading it into
** a CDO Message object.
**/ _StreamPtr pStm(__uuidof(Stream));
_variant_t varOptional(DISP_E_PARAMNOTFOUND,VT_ERROR);
try {
pStm->Open(
// pStm->raw_Open(
varOptional,
adModeUnknown,
adOpenStreamUnspecified,
NULL,
NULL);
pStm->LoadFromFile(path);
}
catch(_com_error e)
{
throw e;
} IMessagePtr iMsg(__uuidof(Message));
IDataSourcePtr iDsrc;
iDsrc = iMsg; try {
iDsrc->OpenObject(pStm,_bstr_t("_Stream"));
}
catch(_com_error e)
{
throw e;
}
return iMsg;
}
void GetFrom()
{
IMessagePtr imsgptr=Load_Message_from_File("c:\\test.eml");
BSTR bsfrom;
imsgptr->get_From(&bsfrom);
_bstr_t bfrom(bsfrom); AfxMessageBox(bfrom);
}
The IBodyPart interface defines a set of methods and properties used to manipulate message body parts.
not all codes are found in MSDN, some of them is written by myself:)