-
Notifications
You must be signed in to change notification settings - Fork 1
/
README
167 lines (111 loc) · 5.57 KB
/
README
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
grepmail - search mailboxes for a particular email
Grepmail searches a mailbox for a given regular expression, and returns those
emails that match it. Piped input is allowed, and date and size restrictions
are supported, as are searches using logical operators. Grepmail also supports
a variety of compression formats: gzip, bzip2, lzip, and xz.
SOME NOTES
perl version:
If you plan to use advanced pattern features such as "(?>...)", you will need
to make sure that your version of perl supports them.
Complex queries:
The -E flag allows you to perform complex searches involving logical
operators. For example,
$email_header =~ /^From: .*\@coppit.org/ && $email =~ /grepmail/i
will find all emails which originate from coppit.org (you must escape the "@"
sign with a backslash), and which contain the keyword "grepmail" anywhere in
the message, in any capitalization.
NOTE: -E support is experimental right now. I'm looking for feedback on the
following:
- Do you like the feature?
- Do you like the Perl-based syntax? Is there an alternative which is easier?
- How should date and size constraints be integrated? Should they be
"variables", a la: "$email =~ /grepmail/ && $date <= 'sep 20 1998' || $size
> 50000"?
- Should -i, -h, and -b be supported in conjunction with -E? (Where "-h
pattern" would mean augmenting the -E pattern with "$email_header =~
/pattern/ && ")
- -S ignores signatures. If/when this feature is implemented for -E, should it
be "global" for all $email_body matches, or should it be possible to specify
this for each $email_body match? For example, one can append an "i" modifier
to an individual pattern match to make it case-insensitive. Should there be
a standard way of dealing with such "global" pattern matching options on an
individual pattern match basis?
Message IDs:
NOTE: For emails without message ids, grepmail will use Digest::MD5 to
compute a hash based on the email header. If you don't have
Digest::MD5, grepmail will just use the header itself as the messsage
id. The Digest::MD5 checksum takes a little while to compute, but
saves a lot of space. Currently there is no easy way to choose space
over time. Let me know if this is a problem.
MODULE DEPENDENCIES
To use this program, you will need to install:
- Mail::Mbox::MessageParser: required
- Date::Parse: required
- Date::Manip: required if you want to search using complex date
specifications (-d)
- Digest::MD5: not required, but can help grepmail use less memory if
you are checking for unique emails (-u) and your emails don't have a
Message-Id header
To test this module, you will need to install:
- Test::More
INSTALLATION
=> On Non-Windows (Unix/Cygwin/etc.) systems:
To install this package, change to the directory where you unarchived this
distribution and type the following:
perl Makefile.PL
make
make test
make install
You can install this package into a non-default location by appending one of
the following to the "perl Makefile.PL" command:
- "PREFIX=/installation/path" (for installation into a custom location),
- "INSTALLDIRS=site" (for installation into site-specific Perl directories)
- "INSTALLDIRS=perl" (for installation into standard Perl directories).
If make test fails, please see the INSTALLATION PROBLEMS section below.
=> On Windows systems:
- Just copy "grepmail" to a place in your path. You may want to rename it
"grepmail.pl" if you've associated .pl files with perl.exe.
CONFIGURATION
You may want to set your MAIL environment variable so that grepmail will know
the default location to search for mailboxes.
If you are terribly concerned about performance, you may want to modify the
value of the variable READ_CHUNK_SIZE located in the code. This variable
controls how much text is read from the mailbox at a time. If the value is set
to 0, the entire file is read into memory. (There is no user-visible option
for setting this value.) You may also want to hack the code to not use
Digest::MD5, thereby trading space for time.
If you frequently use the same set of flags, you may wish to alias "grepmail"
to "grepmail -flags" within your command interpreter (shell). See the
documentation for your shell for details on how to do this.
INSTALLATION PROBLEMS
If "make test" fails, run
make test TEST_VERBOSE=1
and see which test(s) are failing. Please email, to the address below, the
output files for the test. Also email the output of running the particular
subtest with the -D flag. e.g.:
./blib/script/grepmail -D --help > test_name.debug
If the first date_manip test case fails, you are in a timezone that
Date::Manip does not yet support. You will need to contact the author of
Date::Manip.
For other bugs, see the section REPORTING BUGS below.
DOCUMENTATION
Just "perldoc grepmail". After installation on Unix systems, you can also do
"man grepmail".
RESOURCES
The CPAN Page:
http://search.cpan.org/dist/grepmail/
The GitHub page:
https://github.com/coppit/grepmail/
Bug and feature tracking:
http://rt.cpan.org/Public/Dist/Display.html?Name=grepmail
When reporting a bug, please attach the output of running grepmail with the -D
switch. If the bug is related to processing of a particular mailbox, try to
trim the mailbox to the smallest set of emails that still exhibit the problem.
Then use the "anonymize_mailbox" program that comes with grepmail to remove
any sensitive information, and attach the mailbox to the bug report.
COPYRIGHT
Copyright (c) 1998-Sep 1 2000 Broc Seib. Copyright (c) Sep 1 2000-2015 David
Coppit. All rights reserved, save those granted by the license. See the file
LICENSE for licensing terms.
AUTHOR
David Coppit <david@coppit.org>