Class: Headbanger::ResqueMailer
- Inherits:
-
Object
- Object
- Headbanger::ResqueMailer
- Defined in:
- lib/headbanger/resque_mailer.rb
Class Method Summary collapse
Instance Method Summary collapse
- #deliver ⇒ Object
-
#initialize(options) ⇒ ResqueMailer
constructor
A new instance of ResqueMailer.
- #smtp_settings ⇒ Object
Constructor Details
#initialize(options) ⇒ ResqueMailer
Returns a new instance of ResqueMailer.
34 35 36 |
# File 'lib/headbanger/resque_mailer.rb', line 34 def initialize( ) @options = .symbolize_keys end |
Class Method Details
.deliver(mail) ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/headbanger/resque_mailer.rb', line 18 def deliver( mail ) destinations = mail.destinations mail.ready_to_send Resque.enqueue( Headbanger::ResqueMailer, :destinations => destinations, :mail => mail.encoded, :from => mail.from ) end |
.perform(options) ⇒ Object
28 29 30 |
# File 'lib/headbanger/resque_mailer.rb', line 28 def perform( ) new( ).deliver end |
.queue ⇒ Object
10 11 12 |
# File 'lib/headbanger/resque_mailer.rb', line 10 def queue @queue end |
.queue=(new_queue) ⇒ Object
14 15 16 |
# File 'lib/headbanger/resque_mailer.rb', line 14 def queue=( new_queue ) @queue = new_queue end |
Instance Method Details
#deliver ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/headbanger/resque_mailer.rb', line 38 def deliver smtp = Net::SMTP.new(smtp_settings[:address], smtp_settings[:port]) smtp.enable_starttls_auto if smtp_settings[:enable_starttls_auto] && smtp.respond_to?(:enable_starttls_auto) from = (@options[:from] && @options[:from].first) || smtp_settings[:user_name] smtp.start( smtp_settings[:domain], smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp| smtp.sendmail(@options[:mail], from, @options[:destinations]) end end |
#smtp_settings ⇒ Object
51 52 53 |
# File 'lib/headbanger/resque_mailer.rb', line 51 def smtp_settings ActionMailer::Base.smtp_settings end |