Hallo,
ich habe ein kleinen EMail Client gebastelt, der mir ein paar Probleme macht.
Wenn ich Spamm Mail empfange die einen Anhang haben, bekomme ich immer eine Fehlermeldung das die Anlage nicht gespeichert werden kann.
Wie kann ich jetzt den Fehler unterdücken ?
hier mal der Code:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43:
| with HauptForm do begin POP.Host := POPHost; POP.Port := POPPort; POP.Username := POPUser; POP.Password := POPPwd; Application.ProcessMessages; POP.Connect; MailCount := POP.CheckMessages; Mailgroesse := POP.RetrieveMailBoxSize div 1024; StatusBar1.Panels.Items[0].Text := 'Anzahl Mails: ' + IntToStr(MailCount) + ' Grösse: ' + IntToStr(MailGroesse) + ' Kb'; for intIndex := 1 to MailCount do begin msg.Clear; POP.Retrieve(intIndex, Msg); itm := Listview1.Items.Add; itm.Caption := Msg.From.Text; itm.SubItems.Add(Msg.Subject); itm.SubItems.Add(inttostr(ord(Msg.Priority))); for i := 0 to Msg.MessageParts.Count - 1 do begin if Msg.MessageParts.Items[i] is TIDAttachment then begin filename := (Msg.MessageParts.Items[i] as TIDAttachment).Filename; (Msg.MessageParts.Items[i] as TIDAttachment).SaveToFile(ExtractFilePath(Application.ExeName) + '/Mail-In/' + filename); end; end; itm.SubItems.Add('Anhang'); itm.SubItems.Add(DateToStr(Msg.Date)); itm.SubItems.Add(TimeTostr(Msg.Date)); if itm.SubItems.Add(IntToStr(POP.RetrieveMsgSize(intIndex) div 1024) + ' K-Bytes') = 0 then itm.SubItems.Add(IntToStr(1) + ' K-Bytes'); Msg.SaveToFile(ExtractFilePath(Application.ExeName) + '/Mail-In/Projekt-Mail' + IntToStr(intIndex) + '.eml'); POP.Delete(intIndex); end; POP.Disconnect; end; end; |
Moderiert von
raziel: Topic aus VCL (Visual Component Library) verschoben am Sa 18.02.2006 um 19:30