This shows you the differences between two versions of the page.
— | procmailrc_template [2016/05/10 08:20] (current) – created jansen | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
+ | #*** Special comments for SfinxUpdate: | ||
+ | # | ||
+ | # | ||
+ | # %SFINX_RELATED% | ||
+ | # %SFINX_NEEDS_EDIT% Default settings is to put spam in a folder named " | ||
+ | . | ||
+ | #*** End of special comments for SfinxUpdate | ||
+ | # | ||
+ | # SET VARIABLES | ||
+ | |||
+ | ############################################################################## | ||
+ | # Internal Variables | ||
+ | |||
+ | SHELL=/ | ||
+ | #your system' | ||
+ | #different shell unless you really know UNIX | ||
+ | |||
+ | LINEBUF=4096 | ||
+ | #" | ||
+ | #particular kinds of email. | ||
+ | |||
+ | PATH=/ | ||
+ | #Path for your programs -- this is probably best | ||
+ | #left alone. | ||
+ | |||
+ | VERBOSE=off | ||
+ | #so that Procmail will log literally every step | ||
+ | #it takes. | ||
+ | #it creates huge logfiles. | ||
+ | |||
+ | |||
+ | ############################################################################## | ||
+ | # Default Program & file locations | ||
+ | |||
+ | FORMAIL=/ | ||
+ | SENDMAIL=/ | ||
+ | |||
+ | MAILDIR=${HOME}/ | ||
+ | |||
+ | DEFAULT=/ | ||
+ | |||
+ | # Folder to save spam to: | ||
+ | JUNKFOLDER=${MAILDIR}junk/ | ||
+ | |||
+ | # There is no automatic deletion in procmail, but you can use the next best | ||
+ | # thing: save to /dev/null | ||
+ | # | ||
+ | |||
+ | # JUNKFOLDER=${DEFAULT} takes care of the case when you want mail in your | ||
+ | # default mailbox (eg to filter in thunderbird) | ||
+ | # | ||
+ | |||
+ | ############################################################################## | ||
+ | # | ||
+ | |||
+ | # All mail is already filtered by MailScanner and SpamAssassin | ||
+ | # but in case you want a customized SpamAssassin, | ||
+ | # beware that this puts quite some load on the mailserver, so consult | ||
+ | # with system management before enabling this option | ||
+ | #:0fw: spamassassin.lock | ||
+ | #| / | ||
+ | |||
+ | ## Mail tagged as spam by SpamAssassin | ||
+ | :0: | ||
+ | * ^X-Spam-Flag: | ||
+ | :0: | ||
+ | * ^Subject: \{Spam\?\} | ||
+ | $JUNKFOLDER | ||
+ | |||
+ | # Comment the preceeding lines if you wish procmail to leave all mail | ||
+ | # in the mailbox (if you use a pop or imap client) | ||
+ | # On the other hand: in that case you can bypass this .procmailrc completely. | ||
+ | |||
+ | ############################################################################# | ||
+ | # e-mail forwarding: | ||
+ | # Many mailservers are sending out error messages or notices if mail is | ||
+ | # recognized as spam. I don't know if that makes any sense, and our server | ||
+ | # does not do that. But anyway, if you have your e-mail forwarded to a place | ||
+ | # that does this, the reply ends up with us (postmaster@strw) and not with the | ||
+ | # spammer. So be nice to your friendly sysadmins, and don't put a unconditional | ||
+ | # forwarding in .forward, but in stead, use procmail to filter out the spam, | ||
+ | # and only forward the mail if it passes the test. So if you want to forward | ||
+ | # your mail, use one of the following recipes (and make sure they stay at the | ||
+ | # END of this file!). | ||
+ | |||
+ | # If you want a copy of your mail forwarded to another address, use this: | ||
+ | #:0 c | ||
+ | # ! your_address@remoteserver.edu | ||
+ | |||
+ | # If you want your mail forwarded to another address, without a local copy | ||
+ | # (especially useful if you no longer work here) use this: | ||
+ | #:0 | ||
+ | # ! your_address@remoteserver.edu | ||
+ | |||
+ | ############################################################################# | ||
+ | # Similar to the note about mail forwarding (see above), use of the ' | ||
+ | # program is not always a good idea. It causes spam bounces to the local | ||
+ | # postmaster (who probably has better things to do than reading spam addressed | ||
+ | # to you) and in the worst case, it confirms the validity of your e-mail | ||
+ | # address to the spammer, which makes your address so much more valuable to | ||
+ | # him. So if you don't want to be burried in spam when you come back from | ||
+ | # your trip, don't use ' | ||
+ | # (from procmailex man page, modified for local settings) | ||
+ | # | ||
+ | # Additional note: as of Fedora Core 1(?), the vacation program is no longer | ||
+ | # distributed with the mail server setup, probably because of these same | ||
+ | # reasons. All the more reason to use an alternative like this. | ||
+ | |||
+ | # New, the E.R. Deul way. SMS " | ||
+ | VAC_MESSAGE=$HOME/ | ||
+ | VAC_CACHE=$HOME/ | ||
+ | VAC_LOCK=$HOME/ | ||
+ | NL=" | ||
+ | " | ||
+ | |||
+ | # test if message is to and from the same address and if suject is | ||
+ | # " | ||
+ | :0 | ||
+ | # adressed to a system user | ||
+ | *$ ^TO_$LOGNAME@ | ||
+ | # and is from that same user | ||
+ | *$ ^From: | ||
+ | # has subject containing only " | ||
+ | * ^Subject: *vacation *\/o(ff|n) *$ | ||
+ | # clean out extra space | ||
+ | * MATCH ?? ()\/o(ff|n) | ||
+ | { | ||
+ | ACTION=$MATCH | ||
+ | # | ||
+ | |||
+ | :0c | ||
+ | * ACTION ?? off | ||
+ | # remove vacation message and cache | ||
+ | | rm $VAC_MESSAGE $VAC_CACHE | ||
+ | :0Ebc | ||
+ | # create vacation message from body | ||
+ | | cat > $VAC_MESSAGE | ||
+ | # FIXME: extra newline in output; how to deal with attachements? | ||
+ | |||
+ | # As confirmation that vacation works the user will receive his own | ||
+ | # auto-reply from the next recipe | ||
+ | } | ||
+ | |||
+ | :0 | ||
+ | # is there a vacation message for that user? | ||
+ | *$? "test -e $VAC_MESSAGE" | ||
+ | { | ||
+ | |||
+ | # from procmailex | ||
+ | :0 Whc: $VAC_LOCK | ||
+ | # Perform a quick check to see if the mail was addressed (to|cc) us | ||
+ | *$ ^TO_$\LOGNAME@ | ||
+ | # Don't reply to daemons and mailinglists | ||
+ | * !^FROM_DAEMON | ||
+ | # Mail loops are evil | ||
+ | *$ !^X-Loop: $LOGNAME@$HOST | ||
+ | | formail -rD 8192 $VAC_CACHE | ||
+ | |||
+ | # if the name was not in the cache | ||
+ | :0 ehc | ||
+ | | (formail -rI" | ||
+ | cat $VAC_MESSAGE ) | $SENDMAIL -oi -t | ||
+ | |||
+ | } | ||
+ | |||
+ | # " | ||
+ | ############################################################################## | ||
+ | |||
+ | ############################################################################## | ||
+ | # if you want your new mail to be delivered to a folder in your home, e.g. | ||
+ | # to make it easier to read the mail with mutt or pine, activate this, and | ||
+ | # configure your mail client to use the file you specify here as your inbox | ||
+ | # mutt: .muttrc: set spoolfile=~/ | ||
+ | # pine: .pinerc: inboxpath=~/ | ||
+ | # elm: setenv MAIL ~/ | ||
+ | |||
+ | #:0: | ||
+ | #incoming | ||
+ | |||
+ | # .procmailrc end | ||
+ | ############################################################################## | ||
+ | |||
+ | </ |