Re: How to handle different Content-Type's

Giganews Newsgroups
Subject: Re: How to handle different Content-Type's
Posted by:  Remy Lebeau (TeamB) (gambit47.no.spam@no.spam.yahoo.com)
Date: Mon, 19 Jul 2004

"Etienne van Tonder" <e…@infoware.com.au> wrote in message
news:D90E95E063A5E240e…@infoware.com.au...

> Currently I am using the following code but it assumes that if
> the content-type does not include multipart it's either text or html.

That is not a correct assumption to make.

> This is not the case as I've discovered as the Content-Type
> can contain many types including "video/x-ms-wmv"

Such types would be interpreted as attachments, not text.

>        if
(indEMailRecv->ContentType.Trim().LowerCase().Pos("multipart/"))

When "multipart/" is not present then check for "text/" instead.  The
message may contain just plain text or HTML without any other parts in the
message.

>        else
>        {
>            LogEntry(fpLog, "GetBody: not a multipart message\
");
>            // Get normal text/plain body
>            textbody = msg->Body->Text;

You should be checking the ContentType again to make sure it really contains
textual content before assuming that it does.

Gambit

Replies

None

In response to

How to handle different Content-Type's posted by Etienne van Tonder on Mon, 19 Jul 2004