Ruby IMAP login error exception

2019-04-13 01:26发布

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?

标签: ruby imap
1条回答
相关推荐>>
2楼-- · 2019-04-13 02:17

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")
查看更多
登录 后发表回答