Class: Dorothy::Mailer

Inherits:
Object
  • Object
show all
Defined in:
lib/dorothy2/do-utils.rb

Overview

CLASS MAILER FROM SALVATORE

Instance Attribute Summary collapse

Instance Method Summary collapse

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()

  @n_emails = [:n_emails]
  @delete_once_downloaded = [:delete_once_downloaded]

  @mailbox = Mail.defaults do
    retriever_method :pop3,
                     :address    => [:address],
                     :user_name  => [:username],
                     :password   => [:password],
                     :port       => [:port],
                     :enable_ssl => [:ssl]
  end
end

Instance Attribute Details

#delete_once_downloadedObject (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_emailsObject (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_emailsObject



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.message
    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