File: headers.rc

package info (click to toggle)
procmail-lib 1:1997.07.22-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 280 kB
  • ctags: 22
  • sloc: perl: 213; makefile: 126; sh: 6
file content (100 lines) | stat: -rw-r--r-- 3,265 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# procmail rc to define patterns to recognize the headers
#
# $Id: headers.rc,v 1.1.1.1 1996/08/16 18:27:10 aks Exp $
#
#    Copyright (C) 1995  Alan K. Stebbens <aks@sgi.com>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# Use these is recipes like this:
#
#  # If mail is from john or mary, then file in "+urgent"
#  :0
#  * $ $FROM(john|mary)@
#  urgent/.
#
#  # if the mail is directly to me, then file it
#  :0
#  * $ $TO($USER)@
#  mymail/.
# 
#  # See which list this mail is from:
#  :0
#  * $ $FROM_LIST_MAILER
#  { LISTADDR=$MATCH }


    # These patterns span any comment text before and after email addresses
    # Use PRE_ADDR_SPAN before any names; it will span a string of non-address
    # characters up to the beginning of a valid email address.

PRE_ADDR_SPAN='(.*[^-(.%@a-zA-Z0-9])?'

    # Use POST_ADDR_SPAN after any names; it will span a string of non-address
    # characters up to the a comma "," or the end of the line

POST_ADDR_SPAN='(([^),.!:a-zA-Z0-9].*)?(,|$[^>]))'

    # These are to match RFC822 style addresses (not including UUCP addresses)
    # Use $USERADDR to match a user name part of an email address

USERADDR='[-a-zA-Z0-9_:.+=/]+'

    # Use $HOSTADDR to match the FQDN hostname part of an address

HOSTADDR='[-a-zA-Z0-9_:.+=/]+'

    # Use $HOSTNAME to match the "plain" hostname (not include any domains)

HOSTNAME='[-a-zA-Z0-9_:+=/]+'

    # Use $ADDR to match either an RFC 822 or UUCP email address

ADDRESS="<?($USERADDR(@$HOSTADDR)?|($HOSTADDR!)+$USERADDR)>?"

    # Use $FROM to match mail from someone

FROM="(^((Reply-To|(Resent-)?(From|Sender)|X-Envelope-From):|>?From )\
$PRE_ADDR_SPAN)"

    # Use $TO to match mail to someone (but only "To:", not "Cc:")

TO="(^((Original-)?(Resent-)?To|(X-Envelope|Apparently(-Resent)?)-To):\
$PRE_ADDR_SPAN)"

    # Use $CC to match mail to someone (but only "Cc:", not "To")

CC="(^((Original-)?(Resent-)?Cc|(X-Envelope|Apparently(-Resent)?)-Cc):\
$PRE_ADDR_SPAN)"

    # For completeness, this should be roughly equivalent to ^TO

TOCC="($TO|$CC)"

    # Pattern to recognize lists by precedence

LIST_PRECEDENCE='(^Precedence:.*(junk|bulk|list))'

    # Names of common list mailers
    # List the more specific mailers first, with generic names later

LIST_MAILERS="(LISTSERV|ListProc|${USERADDR}-(l(ist)?|request|own[er]r)|\
owner-${USERADDR}|Majordomo?|Mailagent|mmdf|news|n?uucp|\
Post(mast(er)?|-?office)|procmail|SmartList|(Mailer-)?daemon|root)"

    # Pattern to put them all together, just to detect mail from a list

FROM_LIST="($LIST_PRECEDENCE|$FROM$LIST_MAILERS$POST_ADDR_SPAN)"