Presentation is loading. Please wait.

Presentation is loading. Please wait.

Charles Duan Harvard Univ. Computer Services March 27, 2002

Similar presentations


Presentation on theme: "Charles Duan Harvard Univ. Computer Services March 27, 2002"— Presentation transcript:

1 Charles Duan Harvard Univ. Computer Services March 27, 2002
Using Procmail Charles Duan Harvard Univ. Computer Services March 27, 2002

2 Using Procmail What is procmail? Basic procmailrc recipes
Using patterns Recipe options File locking September 12, 2017September 12, 2017

3 Using Procmail What is procmail? Basic procmailrc recipes
Using patterns Recipe options File locking September 12, 2017September 12, 2017

4 What is Procmail? Procmail is a processor of e-mail
Filter mail by headers/content Multiple delivery possibilities Mailboxes Forwarding Addresses Programs September 12, 2017September 12, 2017

5 Procmail Recipes Procmail filters s based on recipes in the .procmailrc file Recipes contain: What kind of the recipe handles What to do with the At most one recipe executes (unless otherwise specified) September 12, 2017September 12, 2017

6 Procmailrc Syntax Header Patterns Action # A basic .procmailrc :0:
* ^From: Patterns Important-folder Action * ^Subject: *\[UA\] * < 1024 ! September 12, 2017September 12, 2017

7 Delivering Mail with Procmail
Mail Received Run .procmailrc Add to .inbox Read a “recipe” No more recipes No match Execute action Match September 12, 2017September 12, 2017

8 Using Procmail What is procmail? Basic procmailrc recipes
Using patterns Recipe options File locking September 12, 2017September 12, 2017

9 Basic Procmail Recipes
Sorting Recipes Forwarding Recipes Program Recipes September 12, 2017September 12, 2017

10 Sorting Recipes Most common recipe used Multiple patterns accepted
:0: * ^Subject: *\[UA\] If Subject contains “[UA]” uas-mail Put it in mailbox “uas-mail” Most common recipe used Multiple patterns accepted September 12, 2017September 12, 2017

11 Forwarding Recipes Multiple forwarding addresses accepted
:0 Header (no trailing colon) * ^From: *ksdavis If it’s from Kevin ! Send it to Multiple forwarding addresses accepted Multiple patterns accepted To keep a copy yourself, use “:0c” September 12, 2017September 12, 2017

12 Program Recipes Used for processing online forms
# Forwarding :0 * ^Subject: *Survey If it’s for the survey | runstats.pl Run my program on it Used for processing online forms Very powerful; proceed with caution I’ll talk later about “:0:” v. “:0” September 12, 2017September 12, 2017

13 Exercise September 12, 2017September 12, 2017

14 Using Procmail What is procmail? Basic procmailrc recipes
Using patterns Recipe options File locking September 12, 2017September 12, 2017

15 E-mail Structure Two parts: header and body Separated by an empty line
Each line of header is “Field: Value” Special “From” line Based on Berkeley mbox format September 12, 2017September 12, 2017

16 E-mail Structure Example
From “From” line From: Aaron Lee Header To: Subject: Interesting ... Date: Sun, 10 Feb Blank line I send you this file in Body order to have your advice I hope you can help me “From” line separates messages September 12, 2017September 12, 2017

17 Regular Expressions “Completely” compatible with egrep
By default, matches only header Watch out for spaces * From: Wrong * From:[ Right! (That’s a space and a tab in [ ]) September 12, 2017September 12, 2017

18 Other Special Patterns
! Invert the pattern ? Run a program, use the exit code < Under specified number of bytes > Over specified number of bytes $ Evaluate quotes like /bin/sh September 12, 2017September 12, 2017

19 Using Procmail What is procmail? Basic procmailrc recipes
Using patterns Recipe options File locking September 12, 2017September 12, 2017

20 Recipe Options Options placed after zero in header
AaEe: Run based on previous recipe f: Change (filter) the mail c: Continue through this recipe Read “man procmailrc” September 12, 2017September 12, 2017

21 Another Exercise September 12, 2017September 12, 2017

22 Using Procmail What is procmail? Basic procmailrc recipes
Using patterns Recipe options File locking September 12, 2017September 12, 2017

23 File Locking Prevents procmail processes from corrupting mailboxes
Locking type depends on header :0 No locking :0: Default lock :0: lock Lock the file lock Not for forwarding, programs (?) September 12, 2017September 12, 2017

24 Hints and Tips Test your recipes before using them
Resources for more information man procmail, procmailrc, procmailex Have fun using procmail! September 12, 2017September 12, 2017

25 The Last Blank Slide September 12, 2017September 12, 2017


Download ppt "Charles Duan Harvard Univ. Computer Services March 27, 2002"

Similar presentations


Ads by Google