Loading ...
Sorry, an error occurred while loading the content.
 

Re: filtering on Subject for one local account only?

Expand Messages
  • Carl Brewer
    ... I ended up using procmail as suggested (and setting procmail as SGID mail, which seemed necessary for it to deliver mail into /var/spool/mail/$USER) Here s
    Message 1 of 6 , Dec 26, 2007
      Carl Brewer wrote:
      >
      > I have a user who wants a very specific filter applied to his email
      > account - he wants to only receive email that has one of two strings in
      > the subject line. They should start with "Token" or "Comment", so a
      > crude and simple regex should do the trick. We're running Postfix 2.2
      > and dovecot, and I have clamav with clamsmtp doing virus filtering on
      > CentOS 5 (RHEL 5).
      >
      > Can anyone point me at a simple howto to do this for just one local
      > mailbox and leave all the rest alone?


      I ended up using procmail as suggested (and setting procmail as SGID
      mail, which seemed necessary for it to deliver mail into
      /var/spool/mail/$USER)

      Here's my .procmailrc for the archives etc :

      # we need to filter only accepting Token or Comment strings in Subject:
      SHELL=/bin/sh

      :0 H:
      * (^Subject:.*Token)|(^Subject:.*Comment)
      $DEFAULT

      # ditch everything else
      :0:
      /dev/null

      :0:$HOME/.lockmail
      $DEFAULT
    Your message has been successfully submitted and would be delivered to recipients shortly.