一、前言
最近在寫一個從gmail批量下載附件的程序,用到了 Mail::POP3Client 和 MIME::Parser 2 個模塊
二、相關文檔
CPAN:
Mail::POP3Client模塊
MIME::Parser模塊
StrawberryPerl模塊的安裝、卸載與查看
三、實現
use Mail::POP3Client;use MIME::Parser; my $U = 'User.Name@gmail.com';my $P = 'uSeR.pAsSwORd';my $X = new MIME::Parser;$X -> output_dir('C://download'); #directory to save attachment my $G = Mail::POP3Client -> new ( USER => $U, PASSWORD => $P, HOST => 'pop.gmail.com', PORT => 995, USESSL => 'true') or die "Can't Connect The Server./n"; for $i (1 .. $G->Count()){ my $C = $G->HeadAndBody($i); my $R = $X->parse_data($C);}$G->Close();
新聞熱點
疑難解答