Re: IdSMTPServer OnMsgReceive event: AMsg TStream variable not populated

Giganews Newsgroups
Subject: Re: IdSMTPServer OnMsgReceive event: AMsg TStream variable not populated
Posted by:  mysticforces (paul.four…@malans.co.za)
Date: Wed, 4 Apr 2007

> I'm using version 10.1.5
>
> This is my code for the IdSMTPServer.OnMsgReceive event:
>
> procedure TForm1.IdSMTPServer1MsgReceive(ASender: TIdSMTPServerContext;
>  AMsg: TStream; var LAction: TIdDataReply);
> var
>  lsStr: TStringList;
> begin
>  lsStr := TStringList.Create;
>  try
>    lsStr.LoadFromStream(AMsg);
>    IdMessage1.From.Address := ASender.From;
>    IdMessage1.Recipients.Assign(ASender.RCPTList);
>    IdMessage1.Body.AddStrings(lsStr);
>    IdSMTP1.Connect;
>    IdSMTP1.Send(IdMessage1);
>    IdSMTP1.Disconnect;
>  finally
>    lsStr.Free;
>  end;
>  LAction := dOk;
> end;
>
> I know it's crude, so please, no comments on how I should code it better.  I
> 'm experimenting at this stage of the project.
>
> My point is, the AMsg variable passed through by the event doesn't have the
> 'message' I'm expecting.  Is there some other place to retrieve the email bo
> dy?  The TStream is totally blank when I evaluated it.  Size = 0.
>
> The message gets sent successfully, but without any subject or body.
>
> Will 10.1.6 fix the problem?
Woops, sorry, wrong newsgroup, please ignore

Replies

None

In response to

IdSMTPServer OnMsgReceive event: AMsg TStream variable not populated posted by mysticforces on Wed, 4 Apr 2007