how do I check email?
I know how to send email...how do I download my email? I've been searching on cpan & google & came across Mail::POP3Client...which I couldn't get to work. I have a gmail account but want to be able to check other accounts as well (which may or may not be pop).
#!/usr/bin/perl
use strict;
use warnings;
use Mail::POP3Client;
use Mail::POP3Client;
my $pop = new Mail::POP3Client( USER => "user",
PASSWORD => "pass",开发者_C百科
HOST => "pop.gmail.com" );
for (my $i = 1; $i <= $pop->Count(); $i++) {
foreach ( $pop->Head( $i ) ) {
/^(From|Subject):\s+/i and print $_, "\n";
}
print "\n";
}
To check Gmail you need to use SSL:
my $pop = new Mail::POP3Client( USER => "user",
PASSWORD => "pass",
HOST => "pop.gmail.com",
USESSL => true );
Note: You need to enable POP in your Gmail acocunt. You can do it following this steps:
http://mail.google.com/support/bin/answer.py?answer=13273
精彩评论