|Subject:||Re: TidSMTPServer.OnMsgReceive weirdness with periods|
|Posted by:||Remy Lebeau (TeamB) (firstname.lastname@example.org)|
|Date:||Wed, 12 Jul 2006|
"Tim Parker-Nance" <tim_…@hotmail.com> wrote in message
> I am not sure if this is related to the 'tidsmtp keeps throwing error
> 10053' thread
Yes, it is. The issue you are seeing is the EXACT issue that the other
discussion talked about.
> if it is can you please give me a summary of what to do
> to get around this please.
That other discussion already explained what to do.
> What I want to do is scan the content of a message received for spam
> in OnMsgReceive and add some extra headers. idMessage seems
> the correct candidate for this.
I already showed code to get TIdSMTPServer's TStream data into a TIdMessage.
Please go read the other discussion again.
> I have created a Server project which does nothing but save the stream
> 2 ways 1) As is (Raw) and 2) via idMessage with NoDecode,
> NoEncode = False (idMessage). Below is the code:
TIdMessage cannot directly parse the TStream data because of the issues
described in the earlier discussion. If you have NoDecode set to False,
then you will have to preprocess the TStream data to reformat it in a way
that TIdMessage.LoadFromStream() can handle. Otherwise, set NoDecode to
True instead, and use the code I posted in that discussion (TIdMessage will
not parse the data into the MessageParts collection when NoDecode is True,
> So I get the following:
> 1) Raw.txt: All is ok
As it should be. TIdSMTPServer does provide the correct data in the
TStream. TIdMessage simply cannot handle it properly at the moment, since
it was designed to parse data that is formatted in another way.
> 2) idMessage.txt: All is not ok. The single . between 5 and 6 caused a
That is because the TStream data is not formatted in a way that TIdMessage
currently requires. Hense the current delemna in TIdMessage's core design
that needs to be addressed by Indy's developers. You will have to manage
the data a little more manually in the meantime.
> Is there a problem in idMessage.LoadFromStream with periods?
Yes. The other discussion went into great detail about that.
> If there is then how do I get around this?
Again, please read the other discussion more carefully. I did post code to
work around it.
TidSMTPServer.OnMsgReceive weirdness with periods posted by Tim Parker-Nance on Wed, 12 Jul 2006