Re: OnReceiveMessage return nothing

Giganews Newsgroups
Subject: Re: OnReceiveMessage return nothing
Posted by:  Remy Lebeau (TeamB) (no.spam@no.spam.com)
Date: Fri, 29 Apr 2005

"ARP" <alexandrepires20…@yahoo.com.br> wrote in message
news:111CD23AF9C8E240alexandrepires20…@yahoo.com.br...

> When the property ReceiveMode of the TidSMTPServer is rmMessage,
> and the message received from OutLook is HTML, the properties
> AMsg.Recipients.EMailAddresses, AMsg.From.Text and AMsg.Subject
> inside of the event OnReceiveMessage, return nothing.

Correct, because when using rmMessage the message data is not parsed at all.
It is captured and stored as-is without any additional processing.  You will
have to access the AMsg.Headers property manually, and parse the AMsg.Body
manually.  Also, in the case of Recipients, you can also access the
TIdSMTPServerThread(ASender.Thread).RCPTList property as well.

If you do not want to do all of that, then you will have to use
rmMessageParsed instead of rmMessage.  However, I should warn you that Indy
9 does not handle parsing today's more complicated email formats very well.
If you find that you are having difficulties receiving complex messages,
then you should set the server's NoDecode property to True and then parse
the AMsg.Body manually, if at all.

In Indy 10, TIdMessage has more advanced parsing features.  However, even
with that support implemented, TIdSMTPServer no longer does any parsing on
mesage data anymore.  In other words, the ReceiveMode property has been
completely removed in Indy 10.  There is a single OnMsgReceive event, and it
doesn't even use TIdMessage at all.  The raw message data is provided in a
TStream as-is instead.

So if you need to do message parsing, you are best off learning how to parse
email data manually either way.

Gambit

Replies

In response to

OnReceiveMessage return nothing posted by ARP on Thu, 28 Apr 2005