From: Stefano Crocco Date: 2006-11-11T06:40:44+09:00 Subject: Re: undefined method `mails' for # (NoMethod There's a mistake in your code. conn.mails return an array of the mails on the server, i.e an array of Net::POPMail objects. The mails method, instead, is a method of class Net::POP3. To make your code work, simply substitute the pop parameter of the block with msg and remove the first line of the block: conn.mails.each do |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.all($stdout) end You can also use the each (or each_mail) methods of Net::POPMail, which also iterate on the mails: conn.each_mail do |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.all($stdout) end -- Posted via http://www.ruby-forum.com/.