Archive Mail _HOUR_ string in MailScanner.conf

Kevin Kobb kkobb at skylinecorp.com
Tue Mar 1 14:43:23 GMT 2011


On 2/25/2011 8:52 AM, Kevin Kobb wrote:
> Hi All,
>
> Recently turned on the archive mail option in MailScanner, and it is
> working fine. The only question I have is that in the MailScanner.conf
> comments, it says that _HOUR_ will be replaced with a two digit hour,
> using padded "0" if needed.
>
> However, on my test box with a setting like:
>
> Archive Mail = /var/spool/MailScanner/archive/_DATE___HOUR_.mbox
>
> I get filenames like 20110225_3.mbox, 20110225_4.mbox, etc. Not a big
> deal deal or anything, just wondered if I am doing something wrong or if
> this is a bug?
>
> I am using MailScanner-4.82.6, with perl 5.10 on FreeBSD 7.4.

OK, I modified Message.pm on a test box like so:

--- Message.pm.orig     2011-02-19 05:56:36.000000000 -0500
+++ Message.pm  2011-02-28 09:15:50.000000000 -0500
@@ -381,8 +381,9 @@
    my($hour, $day, $month, $year, $date);
    ($hour, $day, $month, $year) = (localtime)[2,3,4,5];
    $date = sprintf("%04d%02d%02d", $year+1900, $month+1, $day);
+  $hour = sprintf("%02d", $hour);
    $this->{datenumber} = $date;
-  $this->{hournumber} = sprintf("%02d", $hour);
+  $this->{hournumber} = $hour;

    # Work out where to archive/copy this message.
    # Could do all the archiving in a different separate place.

I don't know if this is the right way to do it, as my programming skills 
are fairly minimal and my perl knowledge is even less, but it looked 
reasonable, and the files come out with two digit hour names now.


More information about the MailScanner mailing list