问题
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