Skip to content

siannopollo/mail_fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fetches emails via the Net::POP3 or Net::IMAP library over an SSL connection.
Also useful with the action_mailer_tls plugin if you want to send and receive
emails through GMail. This plugin has only been tested against Rails 2, so,
caveat emptor...

The fetcher assumes there is a mail_fetcher.yml file in the config/ directory, and a
sample can be seen in the mail_fetcher.yml.example file. The config expects a
hash, so configuring it at runtime is also possible, like so:

  MailFetcher.config = { :server => "pop.gmail.com", :username => "[email protected]", :password => "mailfetchertest" }

Somewhere in your app (most likely in environment.rb) you need to specify the
mailer class you wish to use, and the protocol:

  MailFetcher.mailer_class = :my_mailer 
  MailFetcher.access = :pop (defaults to :imap)

And this would use the MyMailer class as the ActionMailer mailing class, and
set @@access to :pop, which would log into the account using Net::POP3.

To fetch email, just call MailFetcher.fetch:

  MailFetcher.fetch(:keep => true, :mailer_methods => [:receive, :spam, :forward_to_friends_and_family])

mail_fetcher.rb and the specs can show you a bunch of other handy things you can do.

Copyright (c) 2008 Steve Iannopollo (steve (at iannopollo dot com)), released under
the MIT license

About

A plugin for accessing POP3/IMAP accounts in rails

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages