Class: Dorothy::Mailer
- Inherits:
-
Object
- Object
- Dorothy::Mailer
- Defined in:
- lib/dorothy2/do-utils.rb
Overview
CLASS MAILER FROM SALVATORE
Instance Attribute Summary collapse
-
#delete_once_downloaded ⇒ Object
readonly
Returns the value of attribute delete_once_downloaded.
-
#n_emails ⇒ Object
readonly
Returns the value of attribute n_emails.
Instance Method Summary collapse
- #get_emails ⇒ Object
-
#initialize(account) ⇒ Mailer
constructor
A new instance of Mailer.
- #read_from_string(string) ⇒ Object
Constructor Details
#initialize(account) ⇒ Mailer
Returns a new instance of Mailer.
540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
# File 'lib/dorothy2/do-utils.rb', line 540 def initialize(account) @n_emails = account[:n_emails] @delete_once_downloaded = account[:delete_once_downloaded] @mailbox = Mail.defaults do retriever_method :pop3, :address => account[:address], :user_name => account[:username], :password => account[:password], :port => account[:port], :enable_ssl => account[:ssl] end end |
Instance Attribute Details
#delete_once_downloaded ⇒ Object (readonly)
Returns the value of attribute delete_once_downloaded.
538 539 540 |
# File 'lib/dorothy2/do-utils.rb', line 538 def delete_once_downloaded @delete_once_downloaded end |
#n_emails ⇒ Object (readonly)
Returns the value of attribute n_emails.
537 538 539 |
# File 'lib/dorothy2/do-utils.rb', line 537 def n_emails @n_emails end |
Instance Method Details
#get_emails ⇒ Object
560 561 562 563 564 565 566 567 568 |
# File 'lib/dorothy2/do-utils.rb', line 560 def get_emails begin @emails = @mailbox.find(:what => :first, :count => @n_emails, :order => :asc, :delete_after_find => @delete_once_downloaded) rescue Net::POPError => e LOGGER.error "MAIL", e. raise end end |
#read_from_string(string) ⇒ Object
555 556 557 |
# File 'lib/dorothy2/do-utils.rb', line 555 def read_from_string(string) Mail.read_from_string(string) end |