#!/usr/bin/env perl =head1 DESCRIPTION Simple notification script using IMAP NOTIFY. Note that it is very simple and implements a custom IMAP client with very limited features. Mostly a proof of concept and personal script. =cut use v5.24; use warnings; use strict; use App::ImapNotify; use Function::Parameters; use MCE::Hobo; use Log::Any::Adapter ('Stderr', log_level => "warn"); my $config = [ { log_id => "server-speed", host => 'mail.server-speed.net', port => 993, username => 'mail-flo', password => trim(`getpw-single msmtp3`), mailboxes => [qw(INBOX INBOX.Postmaster INBOX.TISS INBOX.tuwel)], }, #{ #log_id => "luxx", #host => 'mail.nano-srv.net', #port => 993, #username => 'bluewind@luxx-area.de', #password => trim(`getpw-single bluewind\@luxx-area.de`), #mailboxes => [qw(INBOX)], #}, ]; #$IO::Socket::SSL::DEBUG = 4; my @workers; for my $single_conf ($config->@*) { push @workers, mce_async { my $app = App::ImapNotify->new($single_conf); $app->loop(); } } map {$_->join()} @workers; fun trim($string) { $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; }