The documentation for net/imap is pretty decent for figuring out what
you want to do… Here is a piece of code from my original script that
could get you started in the right direction.
require ‘net/imap’
imap = Net::IMAP.new(server)
imap.login(user, pass)
imap.examine(‘INBOX’)
smtp = Net::SMTP.new(srvr, 25)
imap.search([“UNSEEN”]).each do |message_id|
envelope = imap.fetch(message_id, “ENVELOPE”)[0].attr[“ENVELOPE”]
from = “#{envelope.from[0].mailbox}@#{envelope.from[0].host}”
subj = envelope.subject
end
imap.logout
I have made some progress with this and can look at mails (headers, body
etc) but imap.store for changing flags has no affect and I don’t get any
errors . .
Suggestions?
Thanks,
Phil.
Anthony P. wrote:
imap.search([“UNSEEN”]).each do |message_id|
I am thinking about writing a very simple IMAP client in Ruby (mostly for
Australia
E-mail: [email protected]