.\" This manpage has been automatically generated by docbook2man .\" from a DocBook document. This tool can be found at: .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . .TH "ARCHIVEMAIL" "1" "15 March 2008" "SP" "" .SH NAME archivemail \- archive and compress your old email .SH SYNOPSIS \fBarchivemail\fR [ \fBoptions\fR ] \fB\fIMAILBOX\fB\fR\fI ...\fR .SH "DESCRIPTION" .PP archivemail is a tool for archiving and compressing old email in mailboxes. By default it will read the mailbox \fIMAILBOX\fR, moving messages that are older that the specified number of days (180 by default) to a \fBmbox\fR(5)-format mailbox in the same directory that is compressed with \fBgzip\fR(1)\&. It can also just delete old email rather than archive it. .PP \fBarchivemail\fR supports reading \fBIMAP\fR, \fBMaildir\fR, \fBMH\fR and \fBmbox\fR-format mailboxes, but always writes \fBmbox\fR-format archives. .PP Messages that are flagged important are not archived or deleted unless explicitely requested with the \fB--include-flagged\fR option. Also, \fBarchivemail\fR can be configured not to archive unread mail, or to only archive messages larger than a specified size. .PP To archive an \fBIMAP\fR-format mailbox, use the format \fIimap://username:password@server/mailbox\fR to specify the mailbox. You can omit the password from the URL; use the \fB--pwfile\fR option to make \fBarchivemail\fR read the password from a file, or alternatively just enter it upon request. If the \fB--pwfile\fR option is set, \fBarchivemail\fR does not look for a password in the URL, and the colon is not considered a delimiter. Substitute '\fBimap\fR\&' with '\fBimaps\fR\&', and \fBarchivemail\fR will establish a secure SSL connection. See below for more \fBIMAP\fR peculiarities. .PP \fBarchivemail\fR has some support for being run as the root user on user mailboxes. When running as root, it will \fBseteuid\fR(2) to the owner of the mailbox it is reading, creating any archive files as that user. \fBWarning:\fR this automatic seteuid feature is insecure and deprecated. It will be removed from later versions of \fBarchivemail\fR\&. .SH "OPTIONS" .TP \fB -d \fINUM\fB, --days=\fINUM\fB\fR Archive messages older than \fINUM\fR days. The default is 180. This option is incompatible with the \fB--date\fR option below. .TP \fB -D \fIDATE\fB, --date=\fIDATE\fB\fR Archive messages older than \fIDATE\fR\&. \fIDATE\fR can be a date string in ISO format (eg '2002-04-23'), Internet format (eg '23 Apr 2002') or Internet format with full month names (eg '23 April 2002'). Two-digit years are not supported. This option is incompatible with the \fB--days\fR option above. .TP \fB -o \fIPATH\fB, --output-dir=\fIPATH\fB\fR Use the directory name \fIPATH\fR to store the mailbox archives. The default is the same directory as the mailbox to be read. .TP \fB -P \fIFILE\fB, --pwfile=\fIFILE\fB\fR Read IMAP password from file \fIFILE\fR instead of from the command line. Note that this will probably not work if you are archiving folders from more than one IMAP account. .TP \fB -F \fISTRING\fB, --filter-append=\fISTRING\fB\fR Append \fISTRING\fR to the IMAP filter string. For IMAP wizards. .TP \fB -s \fINAME\fB, --suffix=\fINAME\fB\fR Use the suffix \fINAME\fR to create the filename used for archives. The default is \fI_archive\fR\&. For example, if you run \fBarchivemail\fR on a mailbox called \fIexsouthrock\fR, the archive will be created with the filename \fIexsouthrock_archive.gz\fR\&. \fINAME\fR is run through the \fBpython\fR(1) \fBtime.strftime()\fR function, which means that you can specify any of the following special directives in \fINAME\fR to make archives named after the archive cut-off date: .RS .TP 0.2i \(bu \fB%a\fR Locale's abbreviated weekday name. .TP 0.2i \(bu \fB%A\fR Locale's full weekday name. .TP 0.2i \(bu \fB%b\fR Locale's abbreviated month name. .TP
#	~/.bash_logout
#	Clean things up when I Exit.

# Below is for Fetchmail clean up
#
#	TDEV=my PRESENT terminal device IE: ttyp0, tty5, .....
#
export TDEV=`tty | sed -n -e "s#/dev/##p"`
#
if [ -s ~/.fetchmail ]; then
#
    if [ -s ~/.fetchmail.$TDEV ]; then
	TEST=`/usr/bin/grep 'notowner' ~/.fetchmail.$TDEV`
#
        if [ ! -z $TEST ]; then
	    /bin/rm -rf ~/.fetchmail.$TDEV
	elif [ -z $TEST ]; then
	    /bin/rm -rf ~/.fetchmail.$TDEV
	    /usr/local/bin/fetchmail -q >/dev/null 2>&1
	fi
#
    else
	echo "WARNING: A process either did not record a ~/.fetchmail.$TDEV" >> ~/.fetchmail.warning.$TDEV
	echo "WARNING: Or removed the file manually ." >> ~/.fetchmail.warning.$TDEV
    fi
#
else
    echo "WARNING: parent process has exit'ed & removed primary ~/.fetchmail.$TDEV " >> ~/.fetchmail.warning.$TDEV
fi
# END of Fetchmail clean up
r side searches. .SS "IMAP URLS" .PP \fBarchivemail\fR\&'s \fBIMAP\fR URL parser was written with the RFC 2882 (\fIInternet Message Format\fR) rules for the local-part of email addresses in mind. So, rather than enforcing an URL-style encoding of non-ascii and reserved characters, it allows to double-quote the username and password. If your username or password contains the delimiter characters '@' or ':', just quote it like this: \fIimap://"username@bogus.com":"password"@imap.bogus.com/mailbox\fR\&. You can use a backslash to escape double-quotes that are part of a quoted username or password. Note that quoting only a substring will not work, and be aware that your shell will probably remove unprotected quotes or backslashes. .PP \fBIMAP\fR servers supporting subfolders may use any character as a mailbox path separator, that is, as an equivalent to the slash character on Unix systems. If you are archiving an IMAP subfolder, first \fBarchivemail\fR will try to open a given mailbox name unchanged; if this fails, it will interpret any slashes in the URL as path separators and try again. .SH "EXAMPLES" .PP .PP To archive all messages in the mailbox \fIdebian-user\fR that are older than 180 days to a compressed mailbox called \fIdebian-user_archive.gz\fR in the current directory: .nf bash$ \fBarchivemail debian-user\fR .fi .PP .PP To archive all messages in the mailbox \fIdebian-user\fR that are older than 180 days to a compressed mailbox called \fIdebian-user_October_2001.gz\fR (where the current month and year is April, 2002) in the current directory: .nf bash$ \fBarchivemail --suffix '_%B_%Y' debian-user\fR .fi .PP .PP To archive all messages in the mailbox \fIcm-melb\fR that are older than the first of January 2002 to a compressed mailbox called \fIcm-melb_archive.gz\fR in the current directory: .nf bash$ \fBarchivemail --date'1 Jan 2002' cm-melb\fR .fi .PP .PP Exactly the same as the above example, using an ISO date format instead: .nf bash$ \fBarchivemail --date=2002-01-01 cm-melb\fR .fi .PP .PP To delete all messages in the mailbox \fIspam\fR that are older than 30 days: .nf bash$ \fBarchivemail --delete --days=30 spam\fR .fi .PP .PP To archive all read messages in the mailbox \fIincoming\fR that are older than 180 days to a compressed mailbox called \fIincoming_archive.gz\fR in the current directory: .nf bash$ \fBarchivemail --preserve-unread incoming\fR .fi .PP .PP To archive all messages in the mailbox \fIreceived\fR that are older than 180 days to an uncompressed mailbox called \fIreceived_archive\fR in the current directory: .nf bash$ \fBarchivemail --no-compress received\fR .fi .PP .PP To archive all mailboxes in the directory \fI$HOME/Mail\fR that are older than 90 days to compressed mailboxes in the \fI$HOME/Mail/Archive\fR directory: .nf bash$ \fBarchivemail -d90 -o $HOME/Mail/Archive $HOME/Mail/*\fR .fi .PP .PP To archive all mails older than 180 days from the given \fBIMAP\fR INBOX to a compressed mailbox INBOX_archive.gz in the \fI$HOME/Mail/Archive\fR directory, quoting the password and reading it from the environment variable \fBPASSWORD\fR: .nf bash$ \fBarchivemail -o $HOME/Mail/Archive imaps://user:'"'$PASSWORD'"'@example.org/INBOX\fR .fi .PP Note the protected quotes. .SH "TIPS" .PP Probably the best way to run \fBarchivemail\fR is from your \fBcrontab\fR(5) file, using the \fB--quiet\fR option. Don't forget to try the \fB--dry-run\fR and perhaps the \fB--copy\fR option for non-destructive testing. .SH "EXIT STATUS" .PP Normally the exit status is 0. Nonzero indicates an unexpected error. .SH "BUGS" .PP If an \fBIMAP\fR mailbox path contains slashes, the archive filename will be derived from the basename of the mailbox. If the server's folder separator differs from the Unix slash and is used in the \fBIMAP\fR URL, however, the whole path will be considered the basename of the mailbox. E.g. the two URLs \fBimap://user@example.com/folder/subfolder\fR and \fBimap://user@example.com/folder.subfolder\fR will be archived in \fIsubfolder_archive.gz\fR and \fIfolder.subfolder_archive.gz\fR, respectively, although they might refer to the same \fBIMAP\fR mailbox. .PP \fBarchivemail\fR does not support reading \fBMMDF\fR or \fBBabyl\fR-format mailboxes. In fact, it will probably think it is reading an \fBmbox\fR-format mailbox and cause all sorts of problems. .PP \fBarchivemail\fR is still too slow, but if you are running from \fBcrontab\fR(5) you won't care. Archiving \fBmaildir\fR-format mailboxes should be a lot quicker than \fBmbox\fR-format mailboxes since it is less painful for the original mailbox to be reconstructed after selective message removal. .SH "SEE ALSO" \fBpython\fR(1), \fBgzip\fR(1), \fBmutt\fR(1), \fBprocmail\fR(1) .SH "URL" .PP The \fBarchivemail\fR home page is currently hosted at sourceforge .SH "AUTHOR" .PP This manual page was written by Paul Rodger \&. Updated and supplemented by Nikolaus Schulz