I’m trying to write a Ruby script that goes through an IMAP server, and I have set this up as test case. For some reason, though, I can’t get it to actually find the port. I’ve even tried running getaddrinfo
, with no luck. It simply won’t acknowledge the server’s existence.
require 'net/imap'
test = File.new "test.txt", 'w'
imap = Net::IMAP.new('imap.google.com', 993, usessl=true, certs=nil, verify=false)
imap.authenticate('LOGIN', 'user', 'pass')
imap.examine('Mail')
imap.search(["SMS"]).each do |msg|
test << msg
end