Email filters in python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • sf

    #1

    Email filters in python

    Would someome like to post their email filters code. Its so common that
    probably some standard library
    supports it or many would have written it already. If I have basic
    structure, I can take from there.

    ( Essentially I want get rid of XP by getting rid of powerful mail client
    "TheBat!" )

    ............... ............
    - open POP-SSL connection to pop.someserver. com
    - Get all mails and store as Unix mail file (mymails)
    - do not delete mails from server
    - close connection.
    ............... ............
    - open mymails file

    - Do following for each mail in mymails file (one by one)
    {
    - get header fields: {FROM, TO, CC, Subject,... more ... }
    - some conditons (FROM is found my addresslist.txt but not part of
    my rejectlist.txt )
    append that mail to some existing file.
    }


    ............... ............
    - open SMTP-TLS connection to smtp.someserver .com
    - send all mails in my unix mail file
    - close connection
    ............... ............


    Thanks.


  • Simon Brunning

    #2
    Re: Email filters in python

    On Fri, 17 Dec 2004 15:07:26 GMT, sf <sf@sf.sf> wrote:[color=blue]
    > Would someome like to post their email filters code. Its so common that
    > probably some standard library
    > supports it or many would have written it already. If I have basic
    > structure, I can take from there.[/color]



    --
    Cheers,
    Simon B,
    simon@brunningo nline.net,

    Comment

    • Diez B. Roggisch

      #3
      Re: Email filters in python

      > ............... ...........[color=blue]
      > - open POP-SSL connection to pop.someserver. com
      > - Get all mails and store as Unix mail file (mymails)
      > - do not delete mails from server
      > - close connection.
      > ............... ...........
      > - open mymails file
      >
      > - Do following for each mail in mymails file (one by one)
      > {
      > - get header fields: {FROM, TO, CC, Subject,... more ... }
      > - some conditons (FROM is found my addresslist.txt but not part of
      > my rejectlist.txt )
      > append that mail to some existing file.
      > }[/color]

      For these two, use fetchmail and procmail.[color=blue]
      > ............... ...........
      > - open SMTP-TLS connection to smtp.someserver .com
      > - send all mails in my unix mail file
      > - close connection[/color]

      I'm not totally sure how to do this best - but here python might indeed
      help, using smtplib and mailbox.

      --
      Regards,

      Diez B. Roggisch

      Comment

      • Christopher De Vries

        #4
        Re: Email filters in python

        I use fetchmail in daemon mode and have procmail set up to filter my
        email through bogofilter (http://bogofilter.sourceforge.net/). As for
        outgoing mail postfix, exim, and sendmail are popular. From my laptop I
        do use a python script to cache mail my mail when I'm not connected. I
        then use a script which sends my email over ssh to my work computer
        which uses sendmail to send it all out. I discuss those scripts at

        and they are written in python.

        Comment

        • Thomas Guettler

          #5
          Re: Email filters in python

          Am Fri, 17 Dec 2004 15:07:26 +0000 schrieb sf:
          [color=blue]
          > Would someome like to post their email filters code. Its so common that
          > probably some standard library
          > supports it or many would have written it already.[/color]

          Look for "getmail". This is a small python script which
          is an alternative for fetchmail.

          Thomas


          --
          Thomas Güttler, http://www.thomas-guettler.de/


          Comment

          Working...