BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

tidmessage content type -D7/indy10

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Jacques
Guest





PostPosted: Mon Mar 14, 2005 1:08 pm    Post subject: tidmessage content type -D7/indy10 Reply with quote



I have a problem setting the content type/MIME? I'd like to know how you set
the content type when RECIEVING a msg or get the program to auto detect what
content type a message is that it recieves and change accordingly.

I currently have tidmsg set to plain/html, but the (html)msgs that i recieve
are still coming out with html tags. Am i missing something?

Thanks


Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Mar 14, 2005 5:59 pm    Post subject: Re: tidmessage content type -D7/indy10 Reply with quote




"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
I have a problem setting the content type/MIME? I'd like to
know how you set the content type when RECIEVING a msg

You are not supposed to set the ContentType when receiving a message. It is
the sender's responsibility to set the ContentType when sending the message.

Quote:
or get the program to auto detect what content type a message
is that it recieves

Did you look at the message's existing ContentType property yet?

Quote:
and change accordingly.

Why are you trying to change it?

Quote:
I currently have tidmsg set to plain/html, but the (html)msgs that
i recieve are still coming out with html tags.

Then either 1) the sender did not set up the message correctly when sending
it, or 2) you are not processing the message correctly. Either way, you did
not show the actual message data or the your actual processing code, so
noone can tell you if anything is wrong. Please provide more details.


Gambit



Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Mar 15, 2005 2:26 am    Post subject: Re: tidmessage content type -D7/indy10 Reply with quote




"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote


Quote:
Yes i have and it was set to text/html, but i still get html tags in
msgs.


As you should be. What, you think Indy will parse the HTML data for you?
No. That is your own responsibility to handle. If you receive an HTML
message, it is your own responsibility to show the content to the user in an
HTML-enabled display, such as a web browser.

Quote:
This is an example of the kind of msgs i get:

There is nothing wrong with that. It is doing what it is supposed to be
doing.

Quote:
And the code for viewing msg:

Your code is not taking HTML into account at all. It is treating it as
plain text. That is why you are seeing the HTML tags. You need to actually
look at the ContentType, see if it is set to "text/html", and if so then
display it accordingly. Right now, you are displaying it as-is without
taking its actual ContentType into account.

Quote:
if list.Selected = nil then
list.Selected.SubItems.Strings[3];

That is an AV waiting to happen. Look very closely at that code. You are
accessing the SubItems via a nil pointer.

Quote:
list.Selected.ImageIndex:=6;

Here, you are accessing Selected without checking for a nil pointer at all.

Quote:
POP1.Retrieve(list.Selected.Index + 1, Mess);

And here too.

Quote:
if (Mess.MessageParts.Items[intIndex] is TIdAttachmentFile) then

As I already told you yesterday, you should be testing for TIdAttachment
instead of TIdAttachmentFile specifically. Otherwise, you will miss
TIdAttachmentMemory entirely. Both are derived from TIdAttachment, so a
single test can account for both types.


Gambit



Back to top
Lance Harris
Guest





PostPosted: Sat Sep 10, 2005 4:03 am    Post subject: Re: tidmessage content type -D7/indy10 Reply with quote

Hi Gambit,

Can I ask a further question here please?

1. Let's say I send a message from Outlook Express to an email
account.

2. I then use POP to retrieve it. OE has embed html in the message and
when I store the message body in a BLOB the html tags are also stored
- no problem.

3. I then send it back as-is via SMTP including the BLOB.

4. OE now shows the message and the html tags are visible. Shouldn't
OE know how to handle the html and strip it or is there something I am
missing?

Thanks,
Lance


On Mon, 14 Mar 2005 18:26:11 -0800, "Remy Lebeau (TeamB)"
<no.spam (AT) no (DOT) spam.com> wrote:

Quote:

"Jacques" <jacques.noah (AT) btinternet (DOT) com> wrote in message
news:423643d0 (AT) newsgroups (DOT) borland.com...

Yes i have and it was set to text/html, but i still get html tags in
msgs.

As you should be. What, you think Indy will parse the HTML data for you?
No. That is your own responsibility to handle. If you receive an HTML
message, it is your own responsibility to show the content to the user in an
HTML-enabled display, such as a web browser.

This is an example of the kind of msgs i get:

There is nothing wrong with that. It is doing what it is supposed to be
doing.

And the code for viewing msg:

Your code is not taking HTML into account at all. It is treating it as
plain text. That is why you are seeing the HTML tags. You need to actually
look at the ContentType, see if it is set to "text/html", and if so then
display it accordingly. Right now, you are displaying it as-is without
taking its actual ContentType into account.

if list.Selected = nil then
list.Selected.SubItems.Strings[3];

That is an AV waiting to happen. Look very closely at that code. You are
accessing the SubItems via a nil pointer.

list.Selected.ImageIndex:=6;

Here, you are accessing Selected without checking for a nil pointer at all.

POP1.Retrieve(list.Selected.Index + 1, Mess);

And here too.

if (Mess.MessageParts.Items[intIndex] is TIdAttachmentFile) then

As I already told you yesterday, you should be testing for TIdAttachment
instead of TIdAttachmentFile specifically. Otherwise, you will miss
TIdAttachmentMemory entirely. Both are derived from TIdAttachment, so a
single test can account for both types.


Gambit


_________________
Using:
Delphi 7
Paradox 7
Windows XP Pro

Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Mon Sep 12, 2005 6:13 pm    Post subject: Re: tidmessage content type -D7/indy10 Reply with quote


"Lance Harris" <lharris (AT) bigpond (DOT) net.au> wrote


Quote:
4. OE now shows the message and the html tags are visible.

Then you did not set up the message correctly before sending it. Please
show your actual code.

Quote:
Shouldn't OE know how to handle the html

That is entirely dependant on how you set up the message.


Gambit



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.