Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Netzwerke (https://www.delphipraxis.net/14-netzwerke/)
-   -   Delphi Spam Mails Filtern oder Löschen wie ? (https://www.delphipraxis.net/63478-spam-mails-filtern-oder-loeschen-wie.html)

wlfmario 19. Feb 2006 13:57


Spam Mails Filtern oder Löschen wie ?
 
Hallo,

ich versuche grade eine Lösung zu finden, wie ich Mails die einen oder keinen Anhang haben und als Spam Makiert sind zu filtern.
Da ich sonnst Probleme bekomme mit dem Speichern der Anlagen.

Problem beschreibung:
Wenn ich eine Mail mit oder ohne Anhang vom Server Lade, Speichere ich die Mail in einem Order und überprüfe ob ein Anhang vorhanden ist.

Wenn ja wird dieser in einem anderen Ordner gespeichert.
Wenn jetzt aber eine Mail als Spam Makiert ist, ist die Orginal Mail ja der Anhang der Spam Mail, was zu Problemen führt beim Speichern der Anlage.

Wie kann ich diese Probleme umgehen ? wie kann man Spam Mails Filtern ?

Danke schon mal für eure Hilfe.

Delphi-Quellcode:
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[2].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)));
        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) + '.txt');
                {        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; }
        POP.Delete(intIndex);
      end;
      POP.Disconnect;
    end;
  end;


Alle Zeitangaben in WEZ +1. Es ist jetzt 08:04 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz