保存邮件附件的问题?急急急
if( Msg->AttachList->Count>0) //保存附件
{
TMemoryStream *temp2;
for(Loop=0;Loop<Msg->AttachList->Count;Loop++)
{
path=ExtractFilePath(ParamStr(0))+"AFP\\"+Msg->AttachList->Items[Loop]->FileName;
temp2=new TMemoryStream();
Msg->AttachList->Items[Loop]->Decoded->SaveToStream(temp2);
temp2->Position=0;
temp2->SaveToFile(path);//就是到这句有问题;错误信息:'Cannot Create d:\mail\afp\test.txt' 其中test.txt为附件名
temp2->Free();
delete temp2;
}
} //保存附件结束
其中Msg为一控件名称,约等于NMPOP3->MailMessage
问题点数:100、回复次数:6Top
1 楼lshon(lshon)回复于 2002-06-07 11:12:02 得分 0
你是不是没有事先创建AFP文件夹?
AFP目录不存在
temp2->SaveToFile(path);就要报错Top
2 楼pp616(坏蛋)回复于 2002-06-07 11:52:54 得分 0
你用indy的控件吧。它把附件都保存好了。Top
3 楼lluunn007(书生)回复于 2002-06-07 12:02:27 得分 0
关注~Top
4 楼china910(东蜀生)回复于 2002-06-07 13:05:55 得分 0
什么是indy控件?
AFP目录是存在的
请高手帮忙!Top
5 楼china910(东蜀生)回复于 2002-06-07 14:18:35 得分 0
SOS,SOSTop
6 楼icyluna(冷月清风)回复于 2002-06-14 12:50:40 得分 100
if( Msg->AttachList->Count>0) //保存附件,
{
for(Loop=0;Loop<Msg->AttachList->Count;Loop++)
{
path=ExtractFilePath(ParamStr(0))+"AFP\\"+Msg->AttachList->Items[Loop]->FileName;
if(Msg->AttachList->Items[Loop]->Decode())
{
Msg->AttachList->Items[Loop]->Decoded->SaveToFile(path);
}Top




