Hello

me too I'd go for something similar to NERDVANA's ++solution: if the server is IMAP then is easier to manipulate than the client.

You can easely readapt the following code that uses Mail::IMAPClient

use strict; use warnings; use Mail::IMAPClient; use Term::ReadKey; use Getopt::Long; my $VERSION = 3; my $user; my $server; my $port; my $ssl; my $imap_folder = "INBOX"; my $sleep = 60; GetOptions ( "u|user=s" => \$user, "s|server=s" => \$server, "p|porta=i" => \$port, "ssl=i" => \$ssl, "f|folder=s" => \$imap_folder, "i|interval=i" => \$sleep, ) or show_help(); sub show_help{ print <<EOH; $0 usage: $0 -user LOGIN -server SERVER -port N [ -ssl 0|1 -folder FOLDER +-interval SECONDS ] -u -user username to authenticate to the specific server -s -server IMAP -p -port -ssl (1 or 0) -f -folder IMAP to monitor ( default: "INBOX" ) -i -interval aka sleep time between checks (default 60) EOH exit; } my %check = (user=>$user,server=>$server,port=>$port,ssl=>$ssl); foreach my $need ( keys %check ){ unless ( defined $check{$need} ){ warn "\nplease specify the parameter: $need"; show_help(); } } print "\n(termite the program using CTRL-C to permit a clean IMAP logo +ut)\n"; print "put the pwd for $user at $server\n"; my $password; ReadMode('noecho'); $password = ReadLine(0); chomp $password; ReadMode 'normal'; my $imap = Mail::IMAPClient->new( Server => $server, User => $user, password => $password, Port => $port, Ssl=> $ssl, Uid=> 1, ) or die "IMAP Failure: $@"; print "\n$user correctly authenticated on $server port $port\n". "check for new messages in $imap_folder every $sleep seconds\n +"; # Handle Ctrl-C $SIG{INT} = sub{ print "\n\nlogout..\n"; $imap->logout(); print "exiting..\n"; exit; }; $imap->Peek(1); $imap->select( $imap_folder ) or die "IMAP Select Error for imap folde +r [$imap_folder]: $@"; my $now = time; my %seen = map { $_ => 1} $imap->sentsince($now); while (1){ my @msgs = $imap->sentsince($now); foreach my $msg (@msgs){ next if $seen{$msg}; my $from = $imap->get_header( $msg, "From" ); my $subj = $imap->get_header( $msg, "Subject" ); print "New message:\n". "\tFROM: $from\n". "\tSUBJ: $subj\n"; $seen{ $msg }++; ##################################### # CHANGE HERE AS NEEDED ##################################### system(1, 'echo', "new msg from $from subj $subj"); } sleep $sleep; $now = time; }

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

In reply to Re: Get saved search data out of Thunderbird and into plain-text file -- IMAP monitoring by Discipulus
in thread Get saved search data out of Thunderbird and into plain-text file by jkeenan1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.