Class: ActionMailer::Base
- Inherits:
-
Object
- Object
- ActionMailer::Base
- Defined in:
- lib/action_mailer/ar_mailer.rb
Overview
Adds sending email through an ActiveRecord table as a delivery method for ActionMailer.
Instance Method Summary collapse
-
#ar_mailer_attribute(key, value = nil) ⇒ Object
Sets a custom email class attribute.
-
#ar_mailer_delivery_time(new_time = nil) ⇒ Object
Sets a delivery time for this email.
-
#ar_mailer_smtp_settings(new_settings = nil) ⇒ Object
Sets custom SMTP settings just for this email.
Instance Method Details
#ar_mailer_attribute(key, value = nil) ⇒ Object
Sets a custom email class attribute. It can be used if the user wants to set custom attributes on his email records, e.g. to track them later. They are automatically set as attributes in the resulting AR record, so make sure that they actually exist as database columns!
17 18 19 20 21 22 23 24 25 |
# File 'lib/action_mailer/ar_mailer.rb', line 17 def ar_mailer_attribute(key, value = nil) attrs = ar_mailer_setting(:custom_attributes) || {} if value attrs[key.to_s] = value ar_mailer_setting(:custom_attributes, attrs) else attrs[key.to_s] end end |
#ar_mailer_delivery_time(new_time = nil) ⇒ Object
Sets a delivery time for this email. If left at nil
, the email is sent immediately.
38 39 40 |
# File 'lib/action_mailer/ar_mailer.rb', line 38 def ar_mailer_delivery_time(new_time = nil) ar_mailer_setting(:delivery_time, new_time) end |
#ar_mailer_smtp_settings(new_settings = nil) ⇒ Object
Sets custom SMTP settings just for this email
30 31 32 |
# File 'lib/action_mailer/ar_mailer.rb', line 30 def ar_mailer_smtp_settings(new_settings = nil) ar_mailer_setting(:smtp_settings, new_settings) end |