Hi,
In mail "Newbie question re: 'net'"
"dhtapp" <dhtapp / cox.net> wrote:
> require 'net/pop'
> mailbox = Net::POP3::new( "pop.west.cox.net" )
> mails = []
> mailbox.start( "dhtapp", <PW here> ) { mails = mailbox.mails }
> print "# of mails: ", mails.size, "\n"
> mails.each { |mail| p mail.header, "\n" }
This script works for me:
require 'net/pop'
host = 'pop.west.cox.net'
port = 110
user = 'dhtapp'
pass = 'Your Password'
pop = Net::POP3.new(host, port)
pop.start(user, pass) {
puts "# of mails: #{pop.mails.size}"
pop.each_mail do |mail|
puts mail.header
end
}
> I've tried moving the "p mail.header" up as a block to the mailbox.start
> call, thinking that maybe the mailbox was closed by the time I tried to
> print the headers out, but it made no difference. Can anyone point me to
Yes, your first error is caused by calling I/O method after closing
POP3 connection. I can't detect the reason of your second error.
-- Minero Aoki