[prev in list] [next in list] [prev in thread] [next in thread] 

List:       ruby-talk
Subject:    Re: How can I get the subject of mail
From:       Craig <cwilliams () easynewsletters ! net>
Date:       2008-05-31 18:24:40
Message-ID: 34107a06-1691-43d6-b3ee-cf59e3de84d1 () i76g2000hsf ! googlegroups ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic