Class: ArMailer::ActiveRecord
- Inherits:
-
Object
- Object
- ArMailer::ActiveRecord
- Defined in:
- lib/ar_mailer/active_record.rb
Constant Summary collapse
- @@email_class_name =
Set the email class for deliveries. Handle class reloading issues which prevents caching the email class.
'Email'
Class Method Summary collapse
Instance Method Summary collapse
-
#deliver!(mail) ⇒ Object
Adds
mail
to the Email table.
Class Method Details
.email_class ⇒ Object
17 18 19 |
# File 'lib/ar_mailer/active_record.rb', line 17 def self.email_class @@email_class_name.constantize end |
.email_class=(klass) ⇒ Object
13 14 15 |
# File 'lib/ar_mailer/active_record.rb', line 13 def self.email_class=(klass) @@email_class_name = klass.to_s end |
Instance Method Details
#deliver!(mail) ⇒ Object
Adds mail
to the Email table. Only the first From address for mail
is used.
25 26 27 28 29 30 31 |
# File 'lib/ar_mailer/active_record.rb', line 25 def deliver!(mail) destinations = mail.destinations sender = (mail['return-path'] && mail['return-path'].spec) || mail.from.first destinations.each do |destination| (mail.email_class || self.class.email_class).create :mail => mail.encoded, :to => destination, :from => sender end end |