-add
option. If no mailbox/folder arguments are given, MHonArc assumes that a
SINGLE message is being added to the archive via standard input. Otherwise,
MHonArc adds the messages contained in the mailboxes/folders specified.
When adding new messages to the archive, MHonArc performs the following steps:
M2H_DBFILE
and M2H_OUTDIR
environment
variables or the command-line options -dbfile
and -outdir
.
Otherwise, the current working directory is used.
NOTE: The database file must be in the same location as the archive since the
M2H_OUTDIR
variable and -outdir
option also specify the location of the
archive.
The database file contains data to update any mail threads and the resource settings when MHonArc was last invoked. This allows new messages to contain the same formatting/resource specifications as existing messages in the archive without having to re-specify the resources each time new messages are added. Resources defined in the database file override the environment variables.
NOTE: If no database file is found, MHonArc will creates a new archive.
.forward
" file in your home directory. Here is how I would set up my
.forward
file to invoke MHonArc on incoming mail:
\ehood, "|/mnt/ehood/bin/webnewmail #ehood"
.forward
entry:
\ehood
" tells sendmail
to still deposit the incoming message to my
mail spool file. The "#ehood
" Bourne shell comment is needed to insure
the command is unique from another user. Otherwise, sendmail
will not
invoke the program for you or the other user.
webnewmail
" is a Perl program that calls MHonArc with the appropriate
arguments. A wrapper program is used instead of calling MHonArc directly to
keep the .forward
file simple. Here is the code to the webnewmail
program:
#!/usr/local/bin/perl $cmd = "/mnt/ehood/bin/mhonarc -add -quiet " . "-outdir /mnt/ehood/public_html/newmail"; open(M2H, "|$cmd"); print M2H <STDIN>; close(M2H);The
webnewmail
can be modified to check the mail header before calling
MHonArc to perform selective archiving of messages. For example, webnewmail
can check the To:
field and only archive messages that come from a specific
mailing list.
cron
(1) to update some mail archives from MH mail folders.
The following entry is in my crontab file:
0 0 * * * webmail
webmail
is a script executed every night that calls MHonArc to perform the
update:
#! /bin/csh -f umask 022 setenv M2H_RCFILE $HOME/.mhonarc.rc ## WWW messages mhonarc -add \ -outdir $HOME/public_html/doc/wwwmail \ $HOME/mail/www folder +www >& /dev/null refile first-last +www.ar >& /dev/null # Archive original messages ## Tools messages mhonarc -add \ -outdir $HOME/public_html/doc/toolsmail \ $HOME/mail/tools $HOME/mail/dtd folder +tools >& /dev/null refile first-last +tools.ar >& /dev/null # Archive original messages folder +dtd >& /dev/null refile first-last +dtd.ar >& /dev/null # Archive original messages folder +inbox >& /dev/null # Set current folder to inboxTo avoid mail everynight from
cron
due to output from MHonArc, the -quiet
option can be used for each call to MHonArc, or use the following line in your
crontab file:
0 0 * * * webmail > /dev/nullStandard error is not redirected to
/dev/null
so mail is still received if errors
occured during MHonArc execution.