I'm using the mail API as so:
require 'yaml'
require 'net/imap'
require 'mail'
yaml = File.open( "/home/thufir/ruby/email.yml" )
email = YAML.load_file( yaml )
server = email["server"]
user = email["user"]
password = email["password"]
puts server
puts user
puts password
imap = Net::IMAP.new(server)
puts "connected"
imap.login(user,password)
puts "logged in"
imap.select('INBOX')
mailIds = imap.search(['ALL'])
mailIds.each do |id|
puts 'ok'
msg = imap.fetch(id,'RFC822')[0].attr['RFC822']
mail = Mail.new(msg)
subj = mail.subject # HERE'S THE SUBJECT FROM THE HEADER
puts subj
end
imap.logout()
imap.disconnect()
and have no problem getting the subject header, that's all good. How do
I get the other headers? Or a Hash of headers? Non-standard headers.
thanks,
Thufir
on 2012-12-15 12:15
on 2012-12-15 17:30
On Sat, Dec 15, 2012 at 3:14 AM, Thufir <hawat.thufir@gmail.com> wrote: > I'm using the mail API as so: > and have no problem getting the subject header, that's all good. How do I > get the other headers? Or a Hash of headers? Non-standard headers. Have you looked at the doc? There's an object called Mail::Header :-)
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.