Perl的Mail::POP3Client模块和Gmail通信实例
一、前言
最近在写一个从gmail批量下载附件的程序,用到了Mail::POP3Client和MIME::Parser2个模块
二、相关文档
CPAN:
Mail::POP3Client模块
MIME::Parser模块
StrawberryPerl模块的安装、卸载与查看
三、实现
useMail::POP3Client;
useMIME::Parser;
my$U='User.Name@gmail.com';
my$P='uSeR.pAsSwORd';
my$X=newMIME::Parser;
$X->output_dir('C:\\download');#directorytosaveattachment
my$G=Mail::POP3Client->new(
USER=>$U,
PASSWORD=>$P,
HOST=>'pop.gmail.com',
PORT=>995,
USESSL=>'true')ordie"Can'tConnectTheServer.\n";
for$i(1..$G->Count())
{
my$C=$G->HeadAndBody($i);
my$R=$X->parse_data($C);
}
$G->Close();
热门推荐
10 财运虎年祝福语简短语
11 单亲爸爸春节祝福语简短
12 狗狗上厕所训练
13 植物种植祝福语简短
14 翻译考试祝福语朋友简短
15 个人周年庆简短祝福语
16 狗狗怎么训练
17 分别祝福语简短搞笑英文
18 生日广州男生祝福语简短