Ruby IMAP登录错误异常 [英] Ruby IMAP login error exception

查看:64
本文介绍了Ruby IMAP登录错误异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用我的Ruby脚本:

With my Ruby script:

imap = Net::IMAP.new('imap.gmail.com')
imap.login("some_email@host.com", password)

我收到以下异常:

A connection attempt failed because
the connected party did not properly
respond after a period of time, or
established connection failed because
connected hos has failed to respond. -
connect(2)

怎么了?

推荐答案

您需要在端口993上使用SSL进行连接.

You need to connect using SSL on port 993.

因此您的代码应为:

imap = Net::IMAP.new('imap.gmail.com', 993, true)
imap.login("user@host.com", "password")

这篇关于Ruby IMAP登录错误异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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