> What would be the basic logic to read a binary attachment.  

For example:

// To collect subpart list:
uses
...
  mimemess,mimepart;
var
  Mime: TMimemess; // globally instance class

// Initialize TMimeMess instance globally:
  Mime:=TMimeMess.Create;

// To read body subpart list from specific message stream:
...
begin

  Mime.Clear;
  listbox1.Clear;

  Mime.Lines.Assign(RAW_Message_Stream);
  Mime.DecodeMessage;

  for n:=0 to mime.MessagePart.GetSubPartCount-1 do
    begin
      with mime.MessagePart.GetSubPart(n) do
      begin
        s:=format('%-30s',[primary+'/'+secondary]);
        s:=lowercase(s)+filename;
      end;
      listbox1.items.Add(s);
    end;
  end;
....

// To save content of specific body part:
procedure TForm1.ListBox1Click(Sender: TObject);
begin

  SaveDialog1.FileName:=
    mime.MessagePart.GetSubPart(ListBox1.ItemIndex).FileName;

  if SaveDialog1.Execute then
  with mime.MessagePart.GetSubPart(ListBox1.ItemIndex) do
  begin
    TargetCharset:=CharsetCode;
    DecodePart;
    DecodedLines.SaveToFile(SaveDialog1.FileName);
  end;

end;

Sasa
--
www.szutils.net

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
synalist-public mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/synalist-public

Reply via email to