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