#!/usr/local/bin/perl -w
use strict;

my $now = time();
my $host = undef;
my $senttime;
while (<>) {
	chomp;
	if (/^Subject: [^ ]*-mailmon ([^ ]*) ([0-9]*)$/) {
		$host = $1;
		$senttime = int($2);
		last;
	}
}

unless (defined $host) {
	exit 0;
}

open LOG, ">>/home/cut/ats1/mailmon/log" or die "can't open log";
print LOG "$host $senttime $now\n";
close LOG;
