X-Git-Url: https://defaria.com/gitweb/?a=blobdiff_plain;f=bin%2FannounceEmail.pl;h=31c75960e52b3bcbf9fab4d9848d4b507616e249;hb=59e4b094ca914ea2ff06f07da91a6c201cc7e466;hp=7e840e10ce7a20032dc573d5d14abcd8346c2e9a;hpb=56813f152ca6be3f803b1363bbe2afddfc1329b0;p=clearscm.git diff --git a/bin/announceEmail.pl b/bin/announceEmail.pl index 7e840e1..31c7596 100755 --- a/bin/announceEmail.pl +++ b/bin/announceEmail.pl @@ -76,6 +76,19 @@ my $IMAP; my %unseen; my $log; +my @greetings = ( + 'Incoming message', + 'You have received a new message', + 'Hey I found this in your inbox', + 'For some unknown reason this guy send you a message', + 'Did you know you just got a message', + 'Potential spam', + 'You received a communique', + 'I was looking in your inbox and found a message', + 'Not sure you want to hear this message', + 'Good news', +); + my %opts = ( usage => sub { pod2usage }, help => sub { pod2usage(-verbose => 2)}, @@ -117,7 +130,7 @@ sub unseenMsgs() { } # unseenMsgs sub Connect2IMAP() { - $log->msg("Connecting to $opts{imap} as $opts{username}...", 1); + $log->msg("Connecting to $opts{imap} as $opts{username}"); $IMAP = Mail::IMAPTalk->new( Server => $opts{imap}, @@ -125,7 +138,7 @@ sub Connect2IMAP() { Password => $opts{password}, ) or $log->err("Unable to connect to IMAP server $opts{imap}: $@", 1); - $log->msg(' connected'); + $log->msg('Connected'); # Focus on INBOX only $IMAP->select('inbox'); @@ -184,10 +197,12 @@ sub MonitorMail() { # Now speak it! debugit "Speaking message from $from"; + my $logmsg = "From $from $subject"; - my $msg = "Message from $from... " . quotemeta $subject; - $msg =~ s/\"/\\"/g; + my $greeting = $greetings[int rand $#greetings]; + my $msg = "$greeting from $from... " . quotemeta $subject; + $msg =~ s/\"/\\"/g; # Log it $log->msg($logmsg);