#!/usr/bin/perl -w use strict; use warnings; use Net::IMAP::Simple; use Email::Simple; my $host = ''; my $user = ''; my $pass = ''; # Create the object my $imap = Net::IMAP::Simple->new($host) ; # Log on if(!$imap->login($user,$pass)){ print STDERR "Login failed: Unable to login. \n"; exit(64); } # Print the subject's of all the messages in the INBOX my $newm = $imap->select('INBOX'); for(my $i = 1; $i <= $newm; $i++) { my $es = Email::Simple->new(join '', @{ $imap->top($i) } ); my $messages = $es->header('Subject')."\n"; my $date = $es->header('Date'); my $today =`date | awk '{print \$1",",\$3,\$2,\$6}'`; chomp $messages; chomp $date; chomp $today; if ($date =~ m/^$today/) { print "$messages \n"; } } $imap->quit;