-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On Jun 1, 2008, at 1:54 AM, Jmlover wrote:

> On Jun 1, 2:23 am, Craig <cwilli... / easynewsletters.net> wrote:
>> On May 31, 1:46 am, Jmlover <Jmlo... / gmail.com> wrote:
>>
>>>    @pop = Net::POP3.new('pop.163.com')
>>>    @pop.start(@username, @password)
>>
>>>    @pop.each_mail do |m|
>>>              # How can I get the subject of mกฉ
>>>        # กมกมกมกมกมกมกมกมกมกมกมกมกมกมกมกม
>>>        # By m.pop?
>>>    end
>>
>>>    @pop.finish
>>
>>> By the way, can I only get the mail header? How?
>>
>>> Thank you!
>>
>> Here is one way.
>>
>> puts m.pop.scan(/Subject:(.+)$/)
>>
>> Cheers,
>>
>> Craig
>
> Thank you for your reply!

You can use the header method if you are only interested in the header:

#!/usr/bin/env ruby

require 'net/pop'
pop = Net::POP.new('pop.example.com')
pop.start('user / example.com', 'password') do |pop|
    pop.each_mail do |mail|
       puts mail.header.scan(/^Subject: (.+)/)
    end
end

http://www.ruby-doc.org/stdlib/libdoc/net/pop/rdoc/classes/Net/POPMail.html

Mike

- --

Mike Stok <mike / stok.ca>
http://www.stok.ca/~mike/

The "`Stok' disclaimers" apply.




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkhCkQkACgkQnsTBwAWZE9rFAgCfdfz9a7fGAAmLNlt7Tolgj9J/
Xb4AoIe1vxT1NBZ/01iFeirSLOSChPrR
=Bqet
-----END PGP SIGNATURE-----