Indy 10 attachments

Giganews Newsgroups
Subject: Indy 10 attachments
Posted by:  Rhys Sage (abu…@127.0.0.1)
Date: Thu, 10 Jun 2004

How do I find the name/type of an attachment? How also do I access the
attachment? I've hunted and the answers are probably staring me in the face.
I just can't find them though.

This is what I have so far for my email reading code:

procedure TForm1.ListBox1Click(Sender: TObject);
var PartCounter:Integer;
begin
IdPOP31.Retrieve(ListBox1.ItemIndex+1,IdMessage1);
Memo1.Clear;
Memo1.Color := clWhite;
Memo1.Lines.AddStrings(IdMessage1.Headers);
if IdMessage1.MessageParts.Count = 0 then
Memo1.Lines.AddStrings(IdMessage1.Body)
  else
      begin
      for PartCounter := 0 to IdMessage1.MessageParts.Count -1 do
          begin
          if (IdMessage1.MessageParts.Items[PartCounter].PartType = mptText)
          then
Memo1.Lines.AddStrings(TIdText(IdMessage1.MessageParts.Items[PartCounter]).B
ody);
          if (IdMessage1.MessageParts.Items[PartCounter].PartType =
mptAttachment) then
            begin
            Memo1.Color := clRed;
            Memo1.Lines.Add(#13+'Alert: attachments');

Memo1.Lines.Add(IdMessage1.MessageParts.Items[PartCounter].DisplayName);
            end;
          end;
      end;
end;

--
Yours

Rhys

Join the anti-spam project:
http://groups.yahoo.com/group/Anti-Spam-Development/
or view my website:
http://www.sageworld.org

"Linux - an operating system that wants to work.
Windows - an operating system that mostly works.
Mac OS - an operating system that really works."

Replies