如何从 Perl 阅读 Gmail 帐户中的邮件? [英] How can I read messages in a Gmail account from Perl?
本文介绍了如何从 Perl 阅读 Gmail 帐户中的邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用模块 Mail::Webmail::Gmail 阅读我 Gmail 帐户中的新邮件.
I have used the module Mail::Webmail::Gmail to read the new messages in my Gmail account.
我为此编写了以下代码:
I have written the following code for this purpose:
use strict;
use warnings;
use Data::Dumper;
use Mail::Webmail::Gmail;
my $gmail = Mail::Webmail::Gmail->new(
username => 'username', password => 'password',
);
my $messages = $gmail->get_messages( label => $Mail::Webmail::Gmail::FOLDERS{ 'INBOX' } );
foreach ( @{ $messages } ) {
if ( $_->{ 'new' } ) {
print "Subject: " . $_->{ 'subject' } . " / Blurb: " . $_->{ 'blurb' } . "\n";
}
}
但它没有打印任何东西.
But it didn't print anything.
任何人都可以帮助我或为此建议任何其他模块吗?
Can anyone help me in this or suggest any other module for this?
提前致谢.
推荐答案
您可以使用 Mail::POP3Client 模块.它用于从 Gmail 帐户获取邮件.
You can use the Mail::POP3Client module. It is used to get the message from the Gmail account.
这篇关于如何从 Perl 阅读 Gmail 帐户中的邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文