Ruby POP3

require 'net/pop'
pop = Net::POP3.new('mail.mnain.org')
pop.start('junk@mnain.org', '********') do |pop|
  puts "# msgs : #{pop.mails.size}"
  pop.mails.each { |msg|
 
  # Print the 'From:' header line
  puts msg.header.split("\r\n").grep(/^From: /)
 
  # Put message to $stdout (by calling <<)
  #puts "\nFull message:\n"
  #msg.delete
  }
end

rubypop.txt · Last modified: 2014/10/26 01:52 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0