Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jan : SMTPserver problem - D7 indy10.0.52
| Subject: | SMTPserver problem - D7 indy10.0.52 |
| Posted by: | "Jacques" (jacques.no..@btinternet.com) |
| Date: | Tue, 31 Jan 2006 17:05:04 |
When executing the code below, the- to,from and msgbody - fields is not
passed through to equivalent fields in the idmessage component. I've tried
loading the amsg stream directly to the idmessage component, but that did
not help either. Is there something i'm missing?
procedure TForm1.IdSMTPServer1MsgReceive(ASender: TIdSMTPServerContext;
AMsg: TStream; var LAction: TIdDataReply);
var
lmsg : TIdMessage;
LStream : TFileStream;
toad,from,sub,body:string;
six:int64;
begin
//get the size of the msg
six:=amsg.siz;
LStream := TFileStream.Create(ExtractFilePath(Application.exename) +
'test.eml', fmCreate);
Try
LStream.CopyFrom(AMsg, 0);
Finally
FreeAndNil(LStream);
End;
LMsg := TIdMessage.Create;
Try
LMsg.LoadFromFile(ExtractFilePath(Application.exename) + 'test.eml',
False);
ToLabel.Caption := lmsg.ReceiptRecipient.Address; <--comes up empty
fromLabel2.Caption := lmsg.From.Address;<--comes up empty
subjectLabel3.Caption := lmsg.Subject;
Memo1.Lines.add(lmsg.Body.Text);<--comes up empty
Finally
FreeAndNil(LMsg);
End;
End;
hope someone can help me with this
Cheers