1ARCHIVEMAIL(1)                                                  ARCHIVEMAIL(1)
2
3
4

NAME

6       archivemail - archive and compress your old email
7

SYNOPSIS

9       archivemail [ options ] MAILBOX ...
10
11

DESCRIPTION

13       archivemail  is a tool written in python(1) for archiving and compress‐
14       ing old email in mailboxes.
15
16       By default it will read the mailbox MAILBOX, moving messages  that  are
17       older that the specified number of days (180 by default) to a mbox-for‐
18       mat mailbox in the same directory that is compressed with gzip(1).
19
20       archivemail supports reading  IMAP, Maildir, MH and  mbox-format  mail‐
21       boxes,  but it will always write archive files to mbox-format mailboxes
22       that are compressed with gzip(1).
23
24       archivemail has some support for being run as the  root  user  on  user
25       mailboxes. When running as root, it will seteuid(2) to the owner of the
26       mailbox it is reading, creating any archive files as that user.
27

OPTIONS

29           -d NUM, --days=NUM
30              Archive messages older than NUM days.  The default is 180.  This
31              option is incompatible with the --date option below.
32
33           -D DATE, --date=DATE
34              Archive  messages older than DATE.  DATE can be a date string in
35              ISO format (eg '2002-04-23'), Internet format (eg '23 Apr 2002')
36              or  Internet  format with full month names (eg '23 April 2002').
37              Two-digit years are not supported.  This option is  incompatible
38              with the --days option above.
39
40           -o PATH, --output-dir=PATH
41              Use  the  directory name PATH to store the mailbox archives. The
42              default is the same directory as the mailbox to be read.
43
44           -P FILE, --pwfile=FILE
45              Read IMAP password from file FILE instead of  from  the  command
46              line.   Note that this will probably not work if you are archiv‐
47              ing folders from more than one IMAP account.
48
49           -F STRING, --filter-append=STRING
50              Append STRING to the IMAP filter string.  For IMAP wizards.
51
52           -s NAME, --suffix=NAME
53              Use the suffix NAME to create the filename  used  for  archives.
54              The  default is _archive. For example, if you run archivemail on
55              a mailbox called exsouthrock, the archive will be  created  with
56              the filename exsouthrock_archive.gz.
57
58              NAME  is  run  through  the  python(1) time.strftime() function,
59              which means that you can specify any of  the  following  special
60              directives in NAME to make archives named after the archive cut-
61              off date:
62
63              · %a Locale's abbreviated weekday name.
64
65              · %A Locale's full weekday name.
66
67              · %b Locale's abbreviated month name.
68
69              · %B Locale's full month name.
70
71              · %c Locale's appropriate date and time representation.
72
73              · %d Day of the month as a decimal number [01,31].
74
75              · %H Hour (24-hour clock) as a decimal number [00,23].
76
77              · %I Hour (12-hour clock) as a decimal number [01,12].
78
79              · %j Day of the year as a decimal number [001,366].
80
81              · %m Month as a decimal number [01,12].
82
83              · %M Minute as a decimal number [00,59].
84
85              · %p Locale's equivalent of either AM or PM.
86
87              · %S Second as a decimal number [00,61]. (1)
88
89              · %U Week number of the year (Sunday as the  first  day  of  the
90                week) as a decimal number [00,53]. All days in a new year pre‐
91                ceding the first Sunday are considered to be in week 0.
92
93              · %w Weekday as a decimal number [0(Sunday),6].
94
95              · %W Week number of the year (Monday as the  first  day  of  the
96                week) as a decimal number [00,53]. All days in a new year pre‐
97                ceding the first Sunday are considered to be in week 0.
98
99              · %x Locale's appropriate date representation.
100
101              · %X Locale's appropriate time representation.
102
103              · %y Year without century as a decimal number [00,99].
104
105              · %Y Year with century as a decimal number.
106
107              · %Z Time zone name  (or  by  no  characters  if  no  time  zone
108                exists).
109
110              · %% A literal "%" character.
111
112           -S NUM, --size=NUM
113              Only archive messages that are NUM bytes or greater.
114
115           -n, --dry-run
116              Don't write to any files -- just show what would have been done.
117              This is useful for testing to see how many messages  would  have
118              been archived.
119
120           -u, --preserve-unread
121              Do  not  archive  any  messages  that  have  not  yet been read.
122              archivemail determines if a message in a mbox-format or  MH-for‐
123              mat mailbox has been read by looking at the Status header (if it
124              exists). If the status header is equal  to  'RO'  or  'OR'  then
125              archivemail  assumes  the  message  has  been  read. archivemail
126              determines if a maildir message has been read by looking at  the
127              filename.  If  the  filename  contains  an 'S' after :2, then it
128              assumes the message has been read.
129
130           --dont-mangle
131              Do not mangle lines in message bodies beginning  with  "From  ".
132              When  archiving  a message from a mailbox not in mbox format, by
133              default archivemail mangles such lines by prepending  a  '>'  to
134              them,  since  mail  user  agents might otherwise interpret these
135              lines as message separators.  Messages  from  mbox  folders  are
136              never mangled.  See mbox(5) for more information.
137
138           --delete
139              Delete  rather  than archive old mail. Use this option with cau‐
140              tion!
141
142           --include-flagged
143              Normally messages that are flagged important are not archived or
144              deleted.  If  you  specify  this  option,  these messages can be
145              archived or deleted just like any other message.
146
147           --no-compress
148              Do not compress any archives using gzip(1).
149
150           --warn-duplicate
151              Warn about duplicate Message-IDs that appear in the input  mail‐
152              box.
153
154           -v, --verbose
155              Reports  lots of extra debugging information about what is going
156              on.
157
158           -q, --quiet
159              Turns on quiet mode. Do not print any statistics about how  many
160              messages  were  archived. This should be used if you are running
161              archivemail from cron.
162
163           -V, --version
164              Display the version of archivemail and exit.
165
166           -h, --help
167              Display brief summary information about how to run archivemail.
168

NOTES

170       archivemail requires python(1) version 2.0 or later.
171
172       To archive an IMAP-format mailbox, use the format imap://username:pass‐
173       word@server/mailbox  to  specify the mailbox. You can omit the password
174       from the URL; use the --pwfile option  to  make  archivemail  read  the
175       password  from a file, or just enter it upon request. Substitute 'imap'
176       with 'imaps', and archivemail will establish a secure SSL connection.
177
178       When reading an mbox-format mailbox, archivemail will create a lockfile
179       with the extension .lock so that procmail will not deliver to the mail‐
180       box while it is being processed. It will also create an  advisory  lock
181       on  the  mailbox  using  flock(2).   archivemail will also complain and
182       abort if a 3rd-party modifies the mailbox while it is being read.
183
184       archivemail will always attempt to preserve the mode,  last-access  and
185       last-modify  times of the input mailbox. However, archive mailboxes are
186       always created with a mode of 0600.
187
188       If archivemail finds a pre-existing  archive  mailbox  it  will  append
189       rather than overwrite that archive.
190
191       archivemail  attempts to find the delivery date of a message by looking
192       for valid dates in the  following  headers,  in  order  of  precedence:
193       Delivery-date,  Date and Resent-Date.  If it cannot find any valid date
194       in these headers, it will use the last-modified file  timestamp  on  MH
195       and Maildir format mailboxes, or the date on the From line on mbox-for‐
196       mat mailboxes.
197
198       archivemail will refuse to operate on mailboxes that are symbolic links
199       or create tempfiles or archives in world-writable directories.
200

EXAMPLES

202       To  archive all messages in the mailbox debian-user that are older than
203       180 days to a compressed mailbox called debian-user_archive.gz  in  the
204       current directory:
205
206       bash$ archivemail debian-user
207
208       To  archive all messages in the mailbox debian-user that are older than
209       180 days to a  compressed  mailbox  called  debian-user_October_2001.gz
210       (where the current month and year is April, 2002) in the current direc‐
211       tory:
212
213       bash$ archivemail --suffix '_%B_%Y' debian-user
214
215       To archive all messages in the mailbox cm-melb that are older than  the
216       first of January 2002 to a compressed mailbox called cm-melb_archive.gz
217       in the current directory:
218
219       bash$ archivemail --date'1 Jan 2002' cm-melb
220
221       Exactly the same as  the  above  example,  using  an  ISO  date  format
222       instead:
223
224       bash$ archivemail --date=2002-01-01 cm-melb
225
226       To delete all messages in the mailbox spam that are older than 30 days:
227
228       bash$ archivemail --delete --days=30 spam
229
230       To  archive  all  read  messages in the mailbox incoming that are older
231       than 180 days to a compressed mailbox called incoming_archive.gz in the
232       current directory:
233
234       bash$ archivemail --preserve-unread incoming
235
236       To archive all messages in the mailbox received that are older than 180
237       days to an uncompressed mailbox called received_archive in the  current
238       directory:
239
240       bash$ archivemail --no-compress received
241
242       To  archive  all  mailboxes  in the directory $HOME/Mail that are older
243       than 90 days to compressed mailboxes in the  $HOME/Mail/Archive  direc‐
244       tory:
245
246       bash$ archivemail -d90 -o $HOME/Mail/Archive $HOME/Mail/*
247

TIPS

249       Probably  the best way to run archivemail is from your crontab(5) file,
250       using the --quiet option.
251
252       Don't forget to try the --dry-run option for non-destructive testing.
253

EXIT STATUS

255       Normally the exit status is 0. Nonzero indicates an unexpected error.
256

BUGS

258       There is no support yet for reading MMDF or Babyl-format mailboxes.  In
259       fact,  archivemail  will  probably  think  it is reading an mbox-format
260       mailbox and cause all sorts of problems.
261
262       archivemail is still too slow, but if you are running  from  crontab(5)
263       you  won't  care.  Archiving  maildir-format  mailboxes should be a lot
264       quicker than mbox-format mailboxes since it is  less  painful  for  the
265       original mailbox to be reconstructed after selective message removal.
266

SEE ALSO

268       python(1), gzip(1), mutt(1), procmail(1)
269

URL

271       The   archivemail   home   page  is  currently  hosted  at  sourceforge
272       <URL:http://archivemail.sourceforge.net>
273

AUTHOR

275       This manual page was written by Paul Rodger  <paul  at  paulrodger  dot
276       com>. Updated by Nikolaus Schulz <microschulz@web.de>
277
278
279
280SP                             02 November 2006                 ARCHIVEMAIL(1)
Impressum