我怎么到Gmail验证使用Perl? [英] How do I authenticate into Gmail using Perl?

查看:120
本文介绍了我怎么到Gmail验证使用Perl?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了模块获得Gmail收件箱中的访问和控制。然而,当我试图通过一个小的Perl脚本来连接和测试功能,我得到这个错误信息。

I've installed this module to gain access and controls within a Gmail inbox. However, when I try to connect through a small Perl script and test the functionality, I get this error message.

Error: Could not login with those credentials - could not find final URL
  Additionally, HTTP error: 200 OK

这是Gmail.pm模块内建立了一个错误。

This is an error built within the Gmail.pm module.

我可以ping问题( https://www.google.com/accounts/ServiceLoginBoxAuth <网址/ A>),所以我觉得麻烦的是没有找到URL。此外,我知道证书是正确的,并在该网址,因为我已经尝试过手动他们的工作。

I can ping the URL in question ( https://www.google.com/accounts/ServiceLoginBoxAuth ) so I feel that the trouble isn't finding the URL. Furthermore, I know the credentials are correct and work at that URL because I have tried them manually.

我用<一个href=\"http://search.cpan.org/~mincus/Mail-Webmail-Gmail-1.09/lib/Mail/Webmail/Gmail.pm#SAMPLE_TEST_SCRIPTS\"相对=nofollow>此内容脚本进行测试。我在适当的地方提供我的凭据。



我还安装了这个模块与同类型的错误。搜索结果
任何想法,为什么我就要受阻?

I'm using this script for testing. I have supplied my credentials in the appropriate places.


I've also installed this module with the same type of error.

Any idea why I'm getting blocked?

推荐答案

使用的Mail :: IMAPClient 如下所示。为了打通邮件传递SSL认证:: IMAPClient,你应该有IO ::插座:: SSL从网:: SSLeay的安装。如果是这样这个工程就像一个魅力。

Use Mail::IMAPClient as shown below. To get pass SSL authentication through Mail::IMAPClient, you should have IO::Socket::SSL from Net::SSLeay installed. If so this works like a charm.

#!/usr/bin/env perl
use strict; use warnings;
use Mail::IMAPClient;

# Connect to IMAP server
my $client = Mail::IMAPClient->new(
  Server   => 'imap.gmail.com',
  User     => 'yourusername',
  Password => 'yourp4a55w0r&',
  Port     => 993,
  Ssl      =>  1,
  )
  or die "Cannot connect through IMAPClient: $!";

# List folders on remote server (see if all is ok)
if ( $client->IsAuthenticated() ) {
  print "Folders:\n";
  print "- ", $_, "\n" for @{ $client->folders() };  
};

# Say so long
$client->logout();

这篇关于我怎么到Gmail验证使用Perl?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆