|Subject:||Re: IdSMTPServer OnMsgReceive event: AMsg TStream variable not populated|
|Posted by:||Remy Lebeau \(Indy Team\) (email@example.com)|
|Date:||Wed, 4 Apr 2007|
"mysticforces" <paul.four…@malans.co.za> wrote in message
> I'm using version 10.1.5
The current version is 10.1.6.
Did you verify that AMsg.Position is 0 before calling
Keep in mind that the RCPTList contains all of the 'To', 'Cc', and
'Bcc' recipients in a single list. If your client uses those header
('Bcc' in particular), then the recpients will be able to see all of
the other recipients, which may not be desirable.
The AMsg stream contains the complete message, including all of the
original headers. You are including those headers in the body of the
message you are sending. You need to strip them out. The most
accurate thing you can do to preserve the original message is to send
the AMsg stream as-is without using TIdMessage at all. Of course,
that would mean issue SMTP commands manually as well, but that is not
very hard. For example:
TIdSMTPAccess = class(TIdSMTP);
TIdSMTPServerContext; AMsg: TStream; var LAction: TIdDataReply);
lsStr := TStringList.Create;
AMsg.Position := 0;
IdSMTP1.SendCmd(MAILFROM_CMD + '<' + ASender.From +
on E: EIdSMTPReplyError do begin
LAction := dOk;
> My point is, the AMsg variable passed through by the event doesn't
> have the 'message' I'm expecting.
Yes, it does. It contains the raw message data as provided by the
> The TStream is totally blank when I evaluated it. Size = 0.
AMsg is guaranteed to never be empty. Do keep in mind, however, that
the IDE debugger might be displaying a Size of 0 when the Size is not
actually 0. That has been known to happen before.
IdSMTPServer OnMsgReceive event: AMsg TStream variable not populated posted by mysticforces on Wed, 4 Apr 2007