清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>
#!/usr/bin/perl use warnings; use strict; use Mail::IMAPClient; use Term::ReadKey; print "Input your password for ops mail:"; ReadMode 2; chomp(my $password=<STDIN>); ReadMode 0; my $imap=Mail::IMAPClient->new( Server => '192.168.10.5', User => 'operate', Password => $password, #Ssl => 1, #Uid => 1, ); { my $folders = $imap->folders or die "List folders error ", $imap->LastError, "\n"; foreach (@$folders) { next if ($_ !~ /inbox/i); $imap->select( $_ ) or die "Select $_ error: ", $imap->LastError, "\n"; last; } } my $mailID; { my @mytime=localtime(time); my $mydate=sprintf("%04d%02d%02d", $mytime[5]+1900,$mytime[4]+1,$mytime[3]); my $output=$imap->search(subject => "$mydate.subject"); my $mailID=$output->[$#{$output}]; print "$mailID\n"; } my $msgbody=$imap->body_string($mailID); # Add your own processing code here! print "$msgbody\n"; $imap->logout or die "Logout error: ", $imap->LastError, "\n"; print "We logout\n";