procmail
[Top] [All Lists]

Re: Comments on this way to use procmail with virtual domains

2007-06-02 21:35:42
On 2-Jun-2007, at 18:33, LuKreme wrote:
The trick was using ${recipient} instead of ${user} for me since mail
is stored in /usr/local/virtual/user(_at_)thedoamin(_dot_)tld

OK, everything appears to be working (mostly) perfectly now.

main.cf:
procmail  unix  -       n       n       -       -       pipe
   -o flags=R user=vpopmail argv=/usr/local/bin/procmail -t -m USER=$ 
{recipient} EXTENSION=${extension} /usr/local/etc/procmailrc.common


$ cat procmailrc.common
DATE=`date '+%Y%m%d'` # Yeah yeah, I'll get to it!
LOGFILE=/usr/local/virtual/.procmail/pm.$DATE.log
NL="
"
WS="    "

VERBOSE=ON
:0
* ! EXTENSION ?? ^^^^
{
   :0
   * $ USER ?? $EXTENSION
   {
      :0
      * USER ?? ^\/[^+]+
      { SHORTU = $MATCH }

      :0
      * USER ?? @\/.*
      { SHORTD = $MATCH }

      LOG="$SHORTU $SHORTD"

      :0
      { USER = "${SHORTU}(_at_)${SHORTD}" }
   }
}

MAILDIR="$HOME/$USER/"
DEFAULT="$MAILDIR"

SWITCHRC="$HOME/.procmail/$USER"

$ cat /usr/local/virtual/.procmail/user(_at_)thedomain(_dot_)tld:
LOGFILE="/usr/local/virtual/.procmail/user(_at_)thedomain(_dot_)tld(_dot_)log"

# If there is an address extension, write the file to a maildir under  
INBOX
:0
* ! EXTENSION ?? ^^^^
.$EXTENSION/

# Otherwise, check spam status
:0 fw
| spamc

:0
* ^X-Spam-Status:(.*\<)?Yes
{
   # really spammy? Dump it
   :0
   * ^X-Spam-Level:.*\*\*\*\*\*\*\*\*\*
   /dev/null

   # Not so spammy?  Mark it as read (not sure this works with  
courier-imap?)
   :0fw
   | formail -I"Status: RO"

   # and file it in .SPAM/
   :0
   .SPAM/
}

It all looks like it is working.  Hopefully nothing breaks in the  
next 4 days whilst I am gone.

-- 
"What's a Velvet Underground?"
   "You wouldn't like it."
"Oh, Be-bop."
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>