Greating wise ones.
I have a script that creates a MAPI session to a microsoft exchange server to scrape through emails. The code works great unless the Exchange server is not available. When this happens I get a popup which reads "Your microsoft exchange server is unavailable" and the script hangs until I click OK on the popup. I was hoping that someone else had run into this before and could tell me how to disable the popup so I can just capture the error and send myself an alert. The connection code is listed below.
Any help as always is greatly appreciated.
my ($server, $alias, $rconn) = @_; # connect to mailbox of CN $
+alias using server $server
my $mapikey = "$server\n$alias";
my $err;
my $session = Win32::OLE->new(qw(Win32::OLE->new(qw(MAPI.Session))
+)) or die Win32::OLE->LastError();
# Try to logon with dynamic profile under current account.
# This may need a reasonable current CDO on your machine.
my $mapi = $session->Logon(undef,undef,undef,1,undef,undef,$mapike
+y);
return $err if $err = Win32::OLE->LastError();