What is the best way of extracting a key value pair from a file.
For example I have an email text file which goes like so :
What is the best way of extracting a key value pair from a file.
For example I have an email text file which goes like so :
If you just need to read e-mails, you can do that without bothering with saving them to a file. The to/from fields will be easily accessible then.
I ended up using an ActionMailer and the plugin linked to here: http://siannopollo.blogspot.com/2008/02/mail-fetcher-fetch-email-from-ruby-and.html
You'll need to modify that plugin a bit, however. If its what you're looking for, let me know when you get stuck with it, and I'll try and help out.
Dan __ wrote:
If you just need to read e-mails, you can do that without bothering with saving them to a file. The to/from fields will be easily accessible then.
I ended up using an ActionMailer and the plugin linked to here: http://siannopollo.blogspot.com/2008/02/mail-fetcher-fetch-email-from-ruby-and.html
You'll need to modify that plugin a bit, however. If its what you're looking for, let me know when you get stuck with it, and I'll try and help out.
Precisely I just need to read emails from the inboxes folder/directory of the James Mail server. (http://james.apache.org)
This however looks promising. It is an SMTP server though (not pop)
Unfortunately, I don't know how to read emails from an SMTP server The plugin I sent only works with POP and IMAP. I faced this problem a little while ago (although I was using a POP server), and I still have bookmarks from when I was searching. Perhaps one of them will help you?
http://wiki.rubyonrails.org/rails/pages/HowToReceiveEmailsWithActionMailer http://blog.craigambrose.com/past/2008/2/9/respond_toemail_or_how_to_handle/ http://offtheline.net/2008/2/14/receiving-email-with-rails
Most of the examples use SMTP, but not the James Mail server you're using. So I think you could use the basic idea, but you'd have to figure out the specific configurations yourself.