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

my $user = "ats1";
my @mailhosts = ( "pat", "greendale", "jess" ); #discovery

foreach my $host (@mailhosts) {
	my $now = time();

	my $smtp = Net::SMTP->new("$host") or do {
		print "can't send to $host\n";
		next;
	};
	$smtp->mail("$user\@raptor.kent.ac.uk");
	$smtp->to("$user\@raptor.kent.ac.uk");
	$smtp->data();
	$smtp->datasend("Subject: $user-mailmon $host $now\n\n"
		. "This is an automated mailmon message.\n");
	$smtp->dataend();
	$smtp->quit();

	print "sent to $host\n";
}
