Class: ActionMailerVerp::PopFetcher
- Inherits:
-
Object
- Object
- ActionMailerVerp::PopFetcher
- Includes:
- Enumerable
- Defined in:
- lib/action_mailer_verp/pop_fetcher.rb
Instance Method Summary collapse
- #connection ⇒ Object
- #each ⇒ Object
-
#initialize(host, username, password) ⇒ PopFetcher
constructor
A new instance of PopFetcher.
Constructor Details
#initialize(host, username, password) ⇒ PopFetcher
Returns a new instance of PopFetcher.
8 9 10 11 12 |
# File 'lib/action_mailer_verp/pop_fetcher.rb', line 8 def initialize(host, username, password) @host = host @username = username @password = password end |
Instance Method Details
#connection ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/action_mailer_verp/pop_fetcher.rb', line 14 def connection if @connection.nil? @connection = Net::POP3.new(@host) @connection.start(@username, @password) end @connection end |
#each ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/action_mailer_verp/pop_fetcher.rb', line 23 def each connection.each_mail do |e| yield Mail.read_from_string(e.pop) e.delete end connection.finish end |