how do i extract the message body using imap. i am hunting it and
cannot seem to figure it out. probably i am not sure what the specific
envelope attribute it should be. i tried envelope.body but it does not
like it.
imap = Net::IMAP.new(‘imap.gmail.com’,‘993’,true)
imap.login(username, password)
imap.select(‘INBOX’)
imap.search([“NOT”, “DELETED” ).each do |message_id|
envelope = imap.fetch(message_id, “ENVELOPE”)[0].attr[“ENVELOPE”]
puts “#{envelope.from[0].name}: \t#{envelope.subject}”
imap.store(message_id, “+FLAGS”, [:Deleted])
end
imap.logout()
imap.disconnect()