MessageParts not working

Giganews Newsgroups
Subject: MessageParts not working
Posted by:  Clint Lord (clintlo…
Date: Tue, 21 Jun 2005

    I am using Indy 10.0.81 with Visual Studio .NET 2003.  When I retrieve a
message and ask the message for it's MessageParts it always says there is
only one.  I have Plain Text emails with attachments, HTML emails without
attachments and several other variants in between.  But no matter how many
"NextPart" block are in the email, the MessageParts always comes back will
one part.  When I pull the one part out of the part collection I always get
a TIdText object that contains the entire message (from the "text/plain" to
"text/html" to "application/octet-stream" to "application/"
parts).  It's like it can't see the parts and just lumps them into one big
part.  My goal is to be able to download all attachments to the emails and
save them, but I'd really like the message object to do some of the parsing
work for me.  According to all the documentation, it should do what I am
looking for.  Any help you be appreciated.

    Here is the code I'm using to test it:

POP3 mypop = new POP3();
mypop.Host = textBox1.Text;

mypop.Username = textBox2.Text;

mypop.Password = textBox3.Text;


int iCount = mypop.CheckMessages();

for (int i = 1; i <= iCount; i++)


    Indy.Sockets.Message mess = new Indy.Sockets.Message();

    mypop.Retrieve(i, mess);

    for (int j = 0; j < mess.MessageParts.Count; j++)


        this.richTextBox1.Text += "Message:" + mess.Subject + " part:" +
j.ToString() + " Type:" + mess.MessageParts[j].ToString() + "\

        this.richTextBox1.Text +=
((Indy.Sockets.Text)mess.MessageParts[j]).Body.GetText() + "\