I am trying to read my gmail inbox using the mail gem. I am able to get the message array using Mail.last
.
Now I want to READ this message. The documentation says--
ail = Mail.read('/path/to/message.eml')
mail.envelope.from #=> 'mikel@test.lindsaar.net'
mail.from.addresses #=> ['mikel@test.lindsaar.net', 'ada@test.lindsaar.net']
mail.sender.address #=> 'mikel@test.lindsaar.net'
mail.to #=> 'bob@test.lindsaar.net'
mail.cc #=> 'sam@test.lindsaar.net'
mail.subject #=> "This is the subject"
mail.date.to_s #=> '21 Nov 1997 09:55:06 -0600'
mail.message_id #=> '<4D6AA7EB.6490534@xxx.xxx>'
mail.body.decoded #=> 'This is the body of the email...
Now, the problem remailns - what is /path/to/message/eml
?
How do i create/locate this EML file?
Thanks.
I know it's a bit late to answer, to say the least.. But hey if anyone will be able to use it:
Once you iterate over the mails, you can just use something like this.
I also suggest checking the full documentation here: http://www.rubydoc.info/github/mikel/mail/Mail
Cheers :)
I've not used this gem, but looking at the README, should be that Mail.last returns an instance of Mail.
You say Mail.lasts works, i.e. it retrieves the email from gmail given your settings https://github.com/mikel/mail#getting-emails-from-a-pop-server
What happens when you do: