Class: ActionMailer::DeliveryMethodActiveRecord
- Inherits:
-
Object
- Object
- ActionMailer::DeliveryMethodActiveRecord
- Defined in:
- lib/action_mailer/ar_mailer.rb
Instance Method Summary collapse
-
#deliver!(mail) ⇒ Object
Actually creates the email record in the database.
-
#initialize(settings) ⇒ DeliveryMethodActiveRecord
constructor
The delivery method seems to be called with a settings hash from the mail gem.
Constructor Details
#initialize(settings) ⇒ DeliveryMethodActiveRecord
The delivery method seems to be called with a settings hash from the mail gem.
72 73 74 |
# File 'lib/action_mailer/ar_mailer.rb', line 72 def initialize(settings) @settings = settings end |
Instance Method Details
#deliver!(mail) ⇒ Object
Actually creates the email record in the database
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/action_mailer/ar_mailer.rb', line 79 def deliver!(mail) if mail['ar_mailer_settings'] ar_settings = YAML::load(mail['ar_mailer_settings'].value).stringify_keys mail['ar_mailer_settings'] = nil else ar_settings = {} end = {} [:delivery_time] = ar_settings.delete('delivery_time') [:smtp_settings] = ar_settings.delete('smtp_settings').try(:symbolize_keys) [:mail] = mail.encoded [:from] = (mail['return-path'] && mail['return-path'].spec) || mail.from.first .reverse_merge!(ar_settings['custom_attributes'] || {}) mail.destinations.each do |destination| ArMailerRevised.email_class.create!(.merge({:to => destination})) end end |