使用我的 Ruby 脚本:
imap = Net::IMAP.new('imap.gmail.com')
imap.login("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f1829e9c94ae949c90989db1999e8285df929e9c" rel="noreferrer noopener nofollow">[email protected]</a>", 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)
出了什么问题?
最佳答案
You need to connect using SSL on port 993 .
因此你的代码应该是这样的:
imap = Net::IMAP.new('imap.gmail.com', 993, true)
imap.login("<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4c393f293e0c24233f38622f2321" rel="noreferrer noopener nofollow">[email protected]</a>", "password")
关于Ruby IMAP 登录错误异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3862851/