Email loopback?

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
smt
Posts: 9
Joined: Tue Nov 22, 2005 5:28 pm

Email loopback?

Post by smt »

Hi!

What is the best way of configuring Hostmonitor to send a email and then receive it back to check the email was collected from the pop3 mailbox by the exchange server and then sent back via it's smtp relay?

:)
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Sorry, HostMonitor does not provide special method to perform such test.

It does not have test method that allows you to send e-mail. You may send e-mail using "send e-mail" action assigned to some test but these mails will be accumulated in mail box because POP3 or IMAP test methods does not remove mails from the box.

Regards
Alex
smt
Posts: 9
Joined: Tue Nov 22, 2005 5:28 pm

Post by smt »

Oh dear that is a shame. Maybe i will have to use "isitup" for this test :(

Thanks for the reply.. :)

:D
broswell
Posts: 7
Joined: Wed May 04, 2005 7:47 pm

I wrote an email round trip program in Perl

Post by broswell »

round.pl username password pophost

It pops and checks for the mail, then sends a new one for the next test.

Bob Roswell
broswell@syssrc.com


use strict;
use Mail::POP3Client;
use Mail::Sendmail;
my $sub="";
my $flag=0;
my $lasttime;
my $elapsed;
my $pop = new Mail::POP3Client( HOST => @ARGV[2] );
$pop->User("@ARGV[0]");
$pop->Pass( @ARGV[1] );
$pop->Connect();
for( my $i = 1; $i <= $pop->Count(); $i++ ) {
foreach( $pop->Head( $i ) ) {
if ( /^(Subject):\sEMAILTEST-\d\d\d\d\d\d\d\d\d\d*/ && $_) {
$sub = $_;
$sub =~ /\d\d\d\d\d\d\d\d\d\d/;
$lasttime = $&;
foreach ($pop->Body($i)) {
print fh $_;
}
close fh;
$pop->Delete($i);
$elapsed = 700;
$elapsed = time() - $lasttime;
if ($elapsed < 600) { $flag = 1;}

}
}
}
if ($flag) {
print "scriptres:OK:$elapsed\n";
}
else {
print "scriptres:Bad:@ARGV[0]\n";
}
$pop->Close();

my %mail;
unshift @{$Mail::Sendmail::mailcfg{'smtp'}} , 'mail.bobroswell.org';

%mail = ( To => @ARGV[0],
From => 'central-dispatch@syssrc.com',
Subject => "EMAILTEST-".time()

);

sendmail(%mail) or die ;
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Nice solution.
We plan to do something like that but always find some more important tasks. I think your script will be useful for some admins, thank you :)

Regards
Alex
Post Reply