1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

using procmail to save attachment then delete mail?

Discussion in 'Linux & Open Source' started by c00kie, 2 Feb 2006.

  1. c00kie


    Joined: 18 Oct 2002

    Posts: 344

    this must be possible but the only info i can find on the net is for deleting the attachment and leaving the email (as a virus scanner would).

    i would like to set up an email address, where every email sent to it would have its attachment stripped (checked for extension possibly??) and put in a directory ideally on an ftp server.
    (this is for a dictation system which emails the wav files, whereas i would like them uploaded to an ftp server.)

    then once the attachment has been removed, delete the email.

    I am using postfix, and then procmail to filter incoming mail into Mailbox folders. i presume this is possible using a .procmailrc file.

    if any one could shed some light on this i'd be very grateful :)

    thanks :D
  2. kzar


    Joined: 3 Sep 2003

    Posts: 212

    I couldn't tell you exactly how to do it but its definately possible. I stripped out the adverts in my daily dilbert by tinkering (using the same programs as you). I would probably either search around for tutorials on the promailrc. You might need to use a program like sed or awk to find / edit strings although it would probably be overkill a bit. Also its worth connecting to irc.freenode.org and going in #procmail (i guess) or even the #debian channel to ask some proper gurus. (If you go in the debian one you have to be very humble and take a bit of abuse but they really know their stuff)

    Anyway good luck :)

    (This is why I really like linux, lets you do nifty things like this when you don't mind tinkering + you learn loads in the process.)
    Last edited: 3 Feb 2006
  3. c00kie


    Joined: 18 Oct 2002

    Posts: 344

    cool. will have a play thanks :D
  4. Vonhelmet


    Joined: 28 Jun 2005

    Posts: 48,107

    Location: On the hoods

    amavisd will do this.