内容 |
这篇文章主要介绍了perl批量下载gmail附件的代码,本文重点在使用mail::pop3client模块和gmail通信的方法,需要的朋友可以参考下。 最近在写一个从gmail批量下载附件的程序,用到了mail::pop3client和mime::parser2个模块 实现代码: 代码如下: 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')ordiecan'tconnecttheserver.\n; for$i(1..$g->count()) { my$c=$g->headandbody($i); my$r=$x->parse_data($c); } $g->close();
|