Skip to content

Instantly share code, notes, and snippets.

@mcansky
Created June 18, 2010 15:00
Show Gist options
  • Select an option

  • Save mcansky/443741 to your computer and use it in GitHub Desktop.

Select an option

Save mcansky/443741 to your computer and use it in GitHub Desktop.
require 'net/imap'
require 'rubygems'
require 'mail'
require 'padrino' # comment this line to test with only mail
require 'padrino-mailer' # comment this line to test with only mail
config = Hash.new
config["email"] = "anadress"
config["password"] = "SOMETHG"
config["port"] = 993
config["ssl"] = true
config["server"] = "a.serv.er"
imap = Net::IMAP.new(config["server"],config["port"],config["ssl"])
imap.login(config["email"],config["password"])
imap.select('INBOX')
source = imap.fetch(1, "BODY[]").first.attr['BODY[]']
mail = Mail.new(source)
mail.parts.each { |d| puts d.content_type }
imap.disconnect
@DAddYE
Copy link

DAddYE commented Jun 18, 2010

line:19 d.content_type_without_symbol

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment