D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
usr
/
share
/
doc
/
procmail
/
Filename :
QuickStart
back
Copy
procmail QuickStart =================== * procmail is not an `interactive' program. It has to run automatically when the mail arrives. Therefore the first thing to do is to tell our MTA that we want procmail to "eat" all our mail messages. The way of doing this depends on the MTA we are using. For example, if we are using sendmail, it will suffice to have a .forward file like this in our home directory: "|exec /usr/bin/procmail" (don't forget the quotes, they are needed in this case). If you are using exim, use this instead as your .forward file: |/usr/bin/procmail The step of creating a .forward file is not needed if the MTA already performs the delivery using procmail. For example, Debian sendmail will automatically use procmail for mail delivering if the sendmail.cf is generated from a sendmail.mc file containing this line: FEATURE(local_procmail)dnl * If we have a stand-alone system with no permanent net connection (like PPP), and we are using fetchmail to get mail from a server, we don't really need a MTA. Just adding --mda "formail -s procmail" to the fetchmail command line (or using the `mda' keyword) will tell it to deliver through procmail. * Next, we have to write a ~/.procmailrc file in our home directory. This file is a set of filtering rules, based on regular expressions. The complete syntax is explained in procmailrc(5). Let's see a real example just to get started. Let's suppose you are subscribed to the following two mailing lists: linux-kernel@vger.kernel.org debian-user@lists.debian.org The first list is managed by Majordomo. Messages coming from a Majordomo list often include a header field "Sender: " which allow easy filtering. The second list is managed my SmartList. Messages coming from a SmartList list may include several headers that can be used to filter it. One of them (in fact, the only that it is not X-whatever) is "Resent-Sender: ". So the following .procmailrc will first filter the mailing lists, and any remaining message will go to the default folder: *--------------------------------->8------------------------------------ PATH=$HOME/bin:/usr/local/bin:/usr/bin:/bin MAILDIR=$HOME/mail # you'd better make sure it exists DEFAULT=$MAILDIR/mbox # completely optional LOGFILE=$MAILDIR/procmail.log # recommended :0: * ^Sender:.*linux-kernel-owner@vger.kernel.org linux-kernel :0: * ^Resent-Sender:.*debian-user-request@lists.debian.org debian-user *--------------------------------->8------------------------------------ From this example additional rules for mailing lists may be created easily. * Once you have received lots of messages you will want to know where did they go. That's what the LOGFILE is for. There is a tool named mailstat which parses this file and shows a summary: mailstat procmail.log The mailstat command that this package provides does really come from the examples directory and it is installed by default. You may have your own modified copy in $HOME/bin, if you like. If you have to refilter an old mail folder according to your current ~/.procmailrc file, you may do the following: cat mbox | formail -s procmail But of course if your mbox file is the target of a procmail recipe you should do this instead: mv mbox whatever cat whatever | formail -s procmail See formail(1) for details. Santiago Vila <sanvila@debian.org>
Name
Size
Last Modified
Owner
Permissions
Actions
examples
Dir
July 28 2023 2:58:45
root
0755
Artistic
5.968
KB
December 31 2000 6:08:10
root
0644
COPYING
17.567
KB
December 31 2000 6:08:10
root
0644
FAQ
13.446
KB
October 12 2019 11:30:02
root
0644
FEATURES
4.099
KB
June 29 2001 5:16:33
root
0644
HISTORY
30.396
KB
September 11 2001 4:53:05
root
0644
KNOWN_BUGS
2.23
KB
June 29 2001 2:20:15
root
0644
QuickStart
3.294
KB
October 12 2019 11:30:02
root
0644
README
7.714
KB
September 11 2001 4:53:09
root
0644
README.Maildir
0.379
KB
October 12 2019 11:30:02
root
0644
telsas_procmailrc
17.985
KB
December 07 2018 12:48:52
root
0644
2017 © D7net | D704T team