Sponsored Content
Full Discussion: Procmail script
Top Forums Shell Programming and Scripting Procmail script Post 302281321 by mojoman on Wednesday 28th of January 2009 04:03:36 PM
Old 01-28-2009
Procmail script

Hi,

I need to write a procmail script such that:

- incoming email is scanned to see if it is spam
- if spam deliver to spam folder
- otherwise deliver to inbox and send a copy to another address.

So far I have:

Code:
:0
* ^Subject:.*SPULK
DUMB

I can make a new recipe on to forward mail to the user's inbox and the other address. Since if it is not spam, procmail will just read the next receipe. If it is SPAM procmail will just execute what is in the first recipe and then get out of .procmailrc

Last edited by mojoman; 01-28-2009 at 05:09 PM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Procmail Tutorial

Hello, Somebody knows a good procmail tutorial in the net? Thanks!:) (1 Reply)
Discussion started by: luiz_fer10
1 Replies

2. UNIX for Dummies Questions & Answers

Procmail filter

Hello, I want to make a filter with procmail, using the day of the week ant the hour to filter the message. If the day is Tuesday, the message is redirected to one address. On the other days, the message goes to another address. The messages will be redirected at 8 am to 17 pm. I tried... (1 Reply)
Discussion started by: luiz_fer10
1 Replies

3. Email Antispam Techniques and Email Filtering

help requested: procmail receipes

Hello all. I want some help procmail receipe. I tried to get some mails' sender and receiptient. Then tried to send them a bash script. But it didnot work. I try a lot of variation of the below receipe. Could anyone can help what is wrong on my receipe? Or if the recepie is correct what can be... (0 Replies)
Discussion started by: kedi
0 Replies

4. Email Antispam Techniques and Email Filtering

procmail rule

I can tell this is not a recently active formum, but here goes, "why doesn't this procmail rule block messages with víagra or v1agra appearing in the subject header :0 * ^Subject:.*(víagra¦v1agra¦pénis¦prescripti0n¦Medicati0n¦M0rtgage¦Xanaxz) { LOG="(THE 7 DIRTY WORDS) " :0 ... (4 Replies)
Discussion started by: jones
4 Replies

5. UNIX for Dummies Questions & Answers

procmail code help

Hello, I was wondering if my code is correct on a procmail recipe I am trying to use. I am trying to set up custom filter for for my email address. What needs to happen is any email NOT addressed to me in the to: or cc: field is deleted. For the time being it is set it up to go to another... (0 Replies)
Discussion started by: Hexabah
0 Replies

6. Shell Programming and Scripting

Help with procmail mailing list

I need to find out for sure whether or not Solaris 10x86 comes with procmail installed? I only need it for mail subscription "Only" WE have about 51 mailing lists subscriptions from listproc. I need help just doing mailing lists. How to best go about this? I downloaded version for Solaris... (0 Replies)
Discussion started by: parente
0 Replies

7. UNIX for Dummies Questions & Answers

Procmail or Spamassassin?

Hello, this is my first visit to your forum and I've searched previous threads for my answer but have not been able to find one. Apologies if there is one that I didn't discover. Is there a way of bouncing or deleting spam that contains non-existent addresses in TO: field but is delivered due... (1 Reply)
Discussion started by: WendyTinley
1 Replies

8. UNIX for Dummies Questions & Answers

a few questions about procmail

Hello, I am running a email server on Centos 5.3 (dovecot, postfix, with emails for a few domains) and I am wondering whether I am using procmail or not. I know procmail is installed because procmail -version returns: Locking strategies: dotlocking, fcntl() Default rcfile: ... (0 Replies)
Discussion started by: JCR
0 Replies

9. UNIX for Dummies Questions & Answers

Procmail

Hi, I have a few questions. I am new to UNIX/Linux. At work I notice that our mail server uses sendmail. When I looked in the sendmail.cf file I see that it is using PROCMAIL as the Local Delivery Agent. Questions:- I looked for /etc/procmail to see its configuration file but I see none.... (0 Replies)
Discussion started by: mojoman
0 Replies

10. UNIX for Dummies Questions & Answers

Help with SendMail Procmail filtering

Hi All, I am very new to Unix. I have a test server running FreeBSD 10.1 and SendMail 8.14.9. I need to filter incoming emails based on the sender's email address or domain and forward them to another address on a different domain as well as to the original recipient. Can I achieve this with... (1 Reply)
Discussion started by: simplemind
1 Replies
BSFILTER(1)						      General Commands Manual						       BSFILTER(1)

NAME
bsfilter -- bayesian spam filter SYNOPSIS
bsfilter [options] [commands] < MAIL bsfilter [options] [commands] MAIL ... DESCRIPTION
bsfilter filters out spam mails. If commands are specified, bsfilter is in maintenance mode, otherwise it is in filtering mode. If bsfilter does not find spam in filtering mode, exit status is 1. If bsfilter runs with --pipe option or finds spam, exit status is 0. COMMANDS
--add-clean -c add mails into the clean token database. --add-spam -s add mails into the spam token database. --sub-clean -C subtract mails from the clean token database. --sub-spam -S subtract mails from the spam token database. --update -u update the probability table from clean and spam token databases. --export-clean export the clean token database. --export-spam export the spam token database. --import-clean import the clean token database. --import-spam import the spam token database. --export-probability export the probability database (for debugging purpose). OPTIONS
--homedir directory specify the name of the bsfilter's home directory. If this option is not used, a directory specified with the environment variable "BSFILTERHOME" is used. If the variable "BSFILTERHOME" is not defined, ".bsfilter" directory under your home is used. If the variable "HOME" is not defined, a directory which bsfilter is located at is used. --config-file file specify the name of the bsfilter's configuration file "bsfilter.conf" in bsfilter's home directory is used by default. --max-line number check and/or study the first number of lines default is 500. 0 means all. --db sdbm|gdbm|bdb1|bdb|qdbm specify the name of database type "sdbm" by default. --jtokenizer bigram|block|mecab|chasen|kakasi -j bigram|block|mecab|chasen|kakasi specify algorithm of a tokenizer for Japanese language "bigram" by default. --list-clean print filename of clean mail. --list-spam print filename of spam. --imap access IMAP server. --imap-server hostname specify hostname of IMAP server. --imap-port number specify port number of IMAP server. default is 143. --imap-auth method specify authorization method. default is "auto". "cram-md5" use "AUTHENTICATE CRAM-MD5" command. "login" use "AUTHENTICATE LOGIN" command. "loginc" use "LOGIN" command. "auto" try "cram-md5", "login" and "loginc" in this order. --imap-user name specify user name of IMAP server. --imap-password password specify password of imap-user. --imap-folder-clean folder specify destination folder for clean mails. "inbox.clean" for example. --imap-folder-spam folder specify destination folder for spams. "inbox.spam" for example. --imap-fetch-unseen filter or study mails without SEEN flag. --imap-fetch-unflagged filter or study mails without "X-Spam-Flag" header. --imap-reset-seen-flag reset SEEN flag when bsfilter moves or modifies mails. --pop work as POP proxy. --pid-file file specify filename for logging process ID of bsfilter "bsfilter.pid" in bsfilter's home directory is used by default this function is valid when "--pop" is specified. --tasktray sit in tasktray this is valid with "--pop" on VisualuRuby. --pop-server hostname specify hostname of POP server. --pop-port number specify port number of POP server. default is 110. --pop-proxy-if address specify address of interface which bsfilter listens at default is 0.0.0.0 and all interfaces are active. --pop-proxy-port number specify port number which bsfilter listens at. default is 10110. --pop-user name optional. specify username of POP server. bsfilter checks match between value of this options and a name which MUA sends. in case of mismatch, bsfilter closes sockets. --pop-proxy-set set[,set...] specify rules of pop proxy. alternative way of pop-server, pop-port, pop-proxy-port and pop-user option. format of "set" is "pop-server:pop-port:[proxy-interface]:proxy-port[:pop-user]". If proxy-interface is specified and isn't 0.0.0.0 , other interfaces are not used. "--pop-proxy-set 192.168.1.1:110::10110" is equivalent with "--pop-server 192.168.1.1 --pop-port 110 --pop-proxy-port 10110". --pop-max-size number When mail is longer than the specified number, the mail is not filtered. When 0 is specified, all mails are tested and filtered. unit is byte. default is 50000. --ssl use POP over SSL with --pop option and use IMAP over SSL with --imap option. --ssl-cert filename|dirname specify a filename of a certificate of a trusted CA or a name of a directory of certificates. --method g|r|rf -m g|r|rf specify filtering method. "rf" by default. "g" means Paul Graham method, "r" means Gary Robinson method, and "rf" means Robin- son-Fisher method. --spam-cutoff number specify spam-cutoff value. 0.9 by default for Paul Graham method. 0.582 by default for Gary Robinson method. 0.95 by default for Robinson-Fisher method. --auto-update -a recognize mails, add them into clean or spam token database and update the probability table. --disable-degeneration -D disable degeneration during probability table lookup. --disable-utf-8 disable utf-8 support. --refer-header header[,header...] refer specified headers of mails. bsfilter refers Ufrom, From, To, Cc, Subject, Reply-to, Return-path, Received, Content-Transfer-Encoding, Content-Type, charset, and Content-Disposition by default. --refer-all-header refer all headers of mails. --ignore-header -H ignore headers of mails. (it is same as --refer-header "".) --ignore-body -B ignore body of mails, except URL or mail address. --ignore-plain-text-part ignore plain text part if html part is included in the mail. --ignore-after-last-atag ignore text after last "A" tag. --mark-in-token characters specify characters which are allowable in a token "*'!" by default. --show-process show summary of execution. --show-new-token show tokens which are newly added into the token database. --mbox use "unix from" to divide mbox format file. --max-mail number reduce token database when the number of stored mails is larger than this one 10000 by default. --min-mail number reduce token database as if this number of mails are stored 8000 by default. --pipe write a mail to stdout. this options is invalid when "--imap" or "--pop" is specified. --insert-revision insert "X-Spam-Revision: bsfilter release..." into a mail. --insert-flag insert "X-Spam-Flag: Yes" or "X-Spam-Flag: No" into a mail. --insert-probability insert "X-Spam-Probability: number" into a mail. --header-prefix string insert "X-specified_string-..." headers, instead of "Spam". (it is valid with --insert-flag and/or --insert-probability option.) --mark-spam-subject insert "[SPAM] " at the beginning of Subject header. --mark-subject-prefix string insert specified string, instead of "[SPAM] ". (it is valid with --mark-spam-subject option.) --show-db-status show numbers of tokens and mails in databases and quit. --help -h show help message. --quiet -q quiet mode. --verbose -v verbose mode. --debug -d debug mode. EXAMPLES
% bsfilter -s ~/Mail/spam/* ## add spam % bsfilter -u -c ~/Mail/job/* ~/Mail/private/* ## add clean mails and update probability table % bsfilter ~/Mail/inbox/1 ## show spam probability ## recipe of procmail :0 HB * ? bsfilter -a spam/. ## recipe of procmail :0 fw | bsfilter -a --pipe --insert-flag --insert-probability SEE ALSO
http://sourceforge.jp/projects/bsfilter/ AUTHOR
The original manual is in the bsfilter command it self which is written by NABEYA Kenichi (upstream author). This manual page was tran- srated from the manual by akira yamada <akira@debian.org> for the Debian system (but may be used by others). Permission is granted to copy, distribute and/or modify this document under the terms of the GNU General Public License, Version 2 any later version published by the Free Software Foundation. On Debian systems, the complete text of the GNU General Public License can be found in /usr/share/common-licenses/GPL. BSFILTER(1)
All times are GMT -4. The time now is 06:26 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy