Skip to content

Instantly share code, notes, and snippets.

@gouf
Created January 8, 2013 14:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gouf/4484320 to your computer and use it in GitHub Desktop.
Save gouf/4484320 to your computer and use it in GitHub Desktop.
require 'net/pop'
SERVER = 'pop.example.com'
ACCOUNT = 'example@example.com'
PADDWORD = 'password'
PORT = 995
# use APOP authentication if $isapop == true
pop = Net::POP3.APOP($isapop).new(SERVER, PORT)
pop.enable_ssl # enable SSL if need.
pop.start ACCOUNT, PASSWORD
if pop.mails.empty?
puts 'No mail.'
else
puts "You have #{pop.mails.length} new messages."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment