Skip to content

Instantly share code, notes, and snippets.

@le0pard
Created September 22, 2015 19:38
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 le0pard/e3e3dd4f243fe80307cb to your computer and use it in GitHub Desktop.
Save le0pard/e3e3dd4f243fe80307cb to your computer and use it in GitHub Desktop.
require 'net/pop'
raise "args shoud be email ans pass" if ARGV.length < 2
username, password = ARGV[0], ARGV[1]
Net::POP3.start('mailtrap.io', 1100, username, password, true) do |pop|
if pop.mails.empty?
puts 'No mail.'
else
pop.each_mail do |m|
puts m.pop
m.delete
end
puts "#{pop.mails.size} mails popped."
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment