Perl的Mail::POP3Client模块和Gmail通信实例

2023-12-05 0 896

一、前言

最近在写一个从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();

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 Perl Perl的Mail::POP3Client模块和Gmail通信实例 https://www.u-9.cn/jiaoben/perl/99941.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务