- my $msg = "Now monitoring email for $opts{username}\@$opts{imap}";
-
- $log->msg($msg);
-
- my $cmd = "/usr/local/bin/gt \"$msg\"";
-
- my ($status, @output) = Execute $cmd;
-
- while () {
- # First close and reselect the INBOX to get its current status
- debugit "Reconnecting to INBOX";
- $IMAP->close;
- $IMAP->select('INBOX')
- or $log->err("Unable to select INBOX - ". $IMAP->errstr(), 1);
-
- # Go through all of the unseen messages and add them to %unseen if they were
- # not there already from a prior run and read
- my %newUnseen = unseenMsgs;
-
- # Now clean out any messages in %unseen that were not in the %newUnseen and
- # marked as previously read
- for (keys %unseen) {
- if (defined $newUnseen{$_}) {
- if ($unseen{$_}) {
- delete $newUnseen{$_};
- } # if
- } else {
- delete $unseen{$_}
+ MONITORMAIL:
+
+ # First close and reselect the INBOX to get its current status
+ $IMAP->close;
+ $IMAP->select('INBOX')
+ or $log->err("Unable to select INBOX - ". $IMAP->errstr(), 1);
+
+ # Go through all of the unseen messages and add them to %unseen if they were
+ # not there already from a prior run and read
+ my %newUnseen = unseenMsgs;
+
+ # Now clean out any messages in %unseen that were not in the %newUnseen and
+ # marked as previously read
+ for (keys %unseen) {
+ if (defined $newUnseen{$_}) {
+ if ($unseen{$_}) {
+ delete $newUnseen{$_};