Dynamic archive file
Shortt, Kevin
KShortt at ussco.com
Sat Feb 11 21:49:35 GMT 2006
Hello everyone,
I am looking to archive all email with MailScanner as it is processed.
I currently use the archive feature with a rule-set. I am only backing up in
(queue file format) for domains that I currently relay to clients with
in-house Exchange servers. Thus I am the savior when the Micro$oft admin
drops the ball. This is working very well.
I want to add archiving for every message. Yet, I want to store in mbox
format with the filename dynamically changing every hour.
Current config:
MailScanner Version Number = 4.35.11
Archive Mail = %rules-dir%/archive.rules
Archive.rules file:
# This stores the sendmail queue files.
To: *@domain1.com /path/to/backup/directory_for_domain1
To: *@domain2.com /path/to/backup/directory_for_domain2
To: *@domain3.com /path/to/backup/directory_for_domain3
FromOrTo: default no
I would like to remove my default line and archive everything else in mbox
format.
The filename needs to be CCYY-MM-DD-HH. Thus I will end up with a directory
filled with files broken up with messages on an hourly basis. I then purge
those on a daily basis, keeping a couple weeks worth of emails.
Doing this with procmail is easy. (already doing it in fact). Yet
MailScanner provides better protection at a different layer of the SMTP
chain. I want to replace my procmail instance of archiving.
Using perl to get the file format is easy. I have that work done. (I share
that below..) I need to know how I am to get MailScanner to know that the
archive filename changes every hour as the date and time changes.
Any ideas? Does the custom function get called for every message? (I am not
thinking so..correct me if I am wrong.)
Can I call a custom function in the ruleset? Like...
FromOrTo: /path/to/backup_dir/&myhourlyfilename
This does not seem right. Any help is appreciated.
Thanks...
-k
My date format with perl...
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
$year = localtime->year + 1900 ;
$month = sprintf ("%02d", localtime->mon);
$day = sprintf ("%02d", localtime->mday);
$hour = sprintf ("%02d", localtime->hour);
print ("$year-$month-$day-$hour\n");
This generates the string... 2006-02-11-16
More information about the MailScanner
mailing list