🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.socket
4 messages
4 total messages Started by Alfred Thomas Thu, 29 Jul 2004 13:55
TIdMessage->LoadFromFile
#5526
Author: Alfred Thomas
Date: Thu, 29 Jul 2004 13:55
20 lines
1546 bytes
Hi

I want to load an e-mail into a TIdMessage from disk. I have the following code:

TIdMessage * Msg = new TIdMessage(NULL);
Msg->LoadFromFile("Whatever.eml");
ShowMessage(Msg->Body->Text);
delete Msg;

The problem is that the email on disk contains text in the body but in the TIdMessage(After loading from file) TIdMessage->Body->Text contains the following:
This is a multi-part message in MIME format.

The email on disk is a TIdMessage that was saved previously. When I open it in Outlook the body is as it should be.
All the other properties(Header,Subject,Recipient,Sender etc.) as well as the attachments, are correct. It is only the Body property that isn't.

Any ideas?

Regards
Alfred Thomas
Re: TIdMessage->LoadFromFile
#5527
Author: Remy Lebeau (TeamB)
Date: Thu, 29 Jul 2004 16:45
15 lines
1357 bytes
"Alfred Thomas" <alfred@fischerint.co.za> wrote in message
news:410901cf$1@newsgroups.borland.com...

> The problem is that the email on disk contains text in the body but
> in the TIdMessage(After loading from file) TIdMessage->Body->Text
> contains the following:
> This is a multi-part message in MIME format.

As well it should.  Your message was MIME-encoded.  Your actual message text
was parsed out and placed into a TIdText instance(s) inside the MessageParts
property.


Gambit
Re: TIdMessage->LoadFromFile
#5541
Author: Alfred Thomas
Date: Tue, 03 Aug 2004 05:55
8 lines
1456 bytes
Hi Remy

Thanks for the response. What is the preferred method of loading an e-mail in order for this not to happen? I am receiving a mail from the postmaster with the original e-mail as an attachment. I want to create a TIdMessage of the original way, so that I can send it to the user exactly as it came in.
When I load from file, how do I know the body was attached as a TIdText and should I scan for a TIdText attachment and add its body to the TIdMessage? Or can I prevent that happening in the first place?

Regards
Alfred Thomas
Re: TIdMessage->LoadFromFile
#5542
Author: Remy Lebeau (TeamB)
Date: Tue, 03 Aug 2004 07:03
29 lines
2023 bytes
"Alfred Thomas" <alfred@fischerint.co.za> wrote in message
news:410f28c6$1@newsgroups.borland.com...

> What is the preferred method of loading an
> e-mail in order for this not to happen?

It is doing exactly what it is supposed to be doing.

If you don't want it to parse the encoded data, then set the NoDecode
property to true, and the data will then be stored in the main Body
property, but then you will be responsible for parsing it yourself manually.

> I am receiving a mail from the postmaster with the original
> e-mail as an attachment. I want to create a TIdMessage of
> the original way, so that I can send it to the user exactly as
> it came in.

Then set the NoDecode and NoEncode properties both to true.

> When I load from file, how do I know the body was attached
> as a TIdText and should I scan for a TIdText attachment

Check the MessageParts.Count property.  If greater than 0, everything is in
the MessageParts.  Otherwise there was no encoded data and it will be stored
in the main Body property instead.


Gambit
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads