Ruby IMAP login error exception

谁都会走 提交于 2019-12-21 22:28:34

问题


With my Ruby script:

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

I get the following exception:

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)

What's wrong?


回答1:


You need to connect using SSL on port 993.

Therefore your code should be this:

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


来源:https://stackoverflow.com/questions/3862851/ruby-imap-login-error-exception

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!