connect to a POP3 server to see if there are any messages available for download
require 'net/pop'
mail_server = Net::POP3.new('mail.mailservernamehere.com')
begin
mail_server.start('username','password')
if mail_server.mails.empty?
puts "No mails"
else
puts "#{mail_server.mails.length} mails waiting"
end
rescue
puts "Mail error"
end