Hi Sam,
Yes, I got till there using the net/pop alright, can retrieve headers
(subject, from, to etc). Im a bit lost now, I request the message.body
as it says on the docs, and it returns me nil, both on multipart or not
messages.
Follows my snippet (message is the full message retrieved with m.pop),
# do whatever with the message
def process_message(message)
p = RMail:
arser.new
m = p.parse(message)
# deals with the header
h = m.header()
subject = h.subject
from = h.from
to = h.to
puts "from: " + from.first
puts "to: " + to.first
puts "subject: " + subject
# deals with the body
puts m.to_s
if m.multipart?()
m.each_part { |g|
puts g.to_s }
else
puts m.decode().to_s
end
end
Everything until the 'body' bit works correctly, and according to the docs,
http://www.lickey.com/rubymail/rubymail/doc/classes/RMail/Message.html#M000015
Its pretty much the same as with the header, as long as you check if it
is multipart or not. Doing a to_s should return me something, what it
doesnt, so obviously Im doing something wrong. Any ideas on that ?
Thanks again !
Cheers
Rove Monteux