Einzelnen Beitrag anzeigen

mcinternet

Registriert seit: 22. Apr 2010
Ort: Odenwald
193 Beiträge
 
Delphi 10.3 Rio
 
#1

IMAP Attachment, ein Byte wird verschluckt

  Alt 24. Jul 2012, 11:25
Moin,

RAD Studio XE2 - 32 Bit. Ich hole mittels IMAP (POP3 geht da aus technischen Gründen nicht) Mail mit GPG-verschlüsselten Attachments ab. Bei ca. 30% wird ein Byte unterschlagen; ist nat. bei Verschlüsselung tödlich.
Das ist auch unabhängig von der Größe der Datei. Hier mal mein Code:
Delphi-Quellcode:
procedure TFrmMain.btn_connectClick(Sender: TObject);
  var iCollection : TIdMessageCollection ;
          AUID : String;
          iloop : integer;
          idx: Integer;
          FN : string;
          MSG : TIdMessage;
          mailcount : integer;
          msgpartcount : integer;

begin
  imap.Connect(true);
  iCollection := TIdMessageCollection.Create(TIdMessageItem);
  MSG := TIdMessage.Create();
  imap.SelectMailBox('inbox');
  mailcount := imap.MailBox.TotalMsgs;
  lbl_mailcount.Caption := inttostr(mailcount);
  for iLoop := 1 to mailcount do begin
     imap.GetUID(iLoop,AUID);
     imap.Retrieve(iLoop,msg);

     lbl_uid.Caption := auid;
     msgpartcount := pred(msg.MessageParts.Count);
     lbl_msgcount.Caption := inttostr(msgpartcount);
     for idx := 0 to msgpartcount do
     begin
       if msg.MessageParts.Items[idx] is TIdAttachmentFile then
        begin
          FN := strPath + 'Export\'+ rightstr(TIdAttachmentFile(msg.MessageParts.Items[idx]).Filename,23);
          if (not fileexists(FN)) and (RightStr(FN,3) = 'gpg') then
          begin
            lbl_fn.Caption := FN;
            TIdAttachmentFile(msg.MessageParts.Items[idx]).SaveToFile(FN);
     end;
  end;
end;
IMAP Einstellungen:
Auth Type: iatUserPass
Host: xxxxx
Mailbox Separator: /
MillisecsToWaitToClearBuffer: 10
Name: IMAP
Passswort: xxxxxx
Port: 143
RetrieveOnSelect: rsDisabled
SASLMechanisms:
Tag: 0
Username: xxxxx
UseTLS: utNoTLSSupport


Wer hat da eine Idee?

Gruß
McInternet
Jörg
  Mit Zitat antworten Zitat