Skip to content

Instantly share code, notes, and snippets.

@dnch
Created June 8, 2010 13:08
Show Gist options
  • Save dnch/429978 to your computer and use it in GitHub Desktop.
Save dnch/429978 to your computer and use it in GitHub Desktop.
require 'net/imap'
imap = Net::IMAP.new("imap.gmail.com", { :ssl => true })
imap.login("username", "password")
imap.status("INBOX", ["UNSEEN"])
imap.select("INBOX")
imap.search(["UNSEEN"]) # => message ids
t = imap.fetch(message_id, "RFC822").first.attr["RFC822") # => whole message in RFC822
Mail.new(t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment