diff options
-rw-r--r-- | actionmailer/CHANGELOG.md | 4 | ||||
-rw-r--r-- | actionmailer/lib/action_mailer/base.rb | 10 | ||||
-rw-r--r-- | guides/source/4_0_release_notes.textile | 2 | ||||
-rw-r--r-- | guides/source/configuring.textile | 4 |
4 files changed, 14 insertions, 6 deletions
diff --git a/actionmailer/CHANGELOG.md b/actionmailer/CHANGELOG.md index 177dc8109f..96cfb43e0b 100644 --- a/actionmailer/CHANGELOG.md +++ b/actionmailer/CHANGELOG.md @@ -1,11 +1,11 @@ ## Rails 4.0.0 (unreleased) ## +* Allow to set default Action Mailer options via `config.action_mailer.default_options=` *Robert Pankowecki* + * Raise an `ActionView::MissingTemplate` exception when no implicit template could be found. *Damien Mathieu* * Asynchronously send messages via the Rails Queue *Brian Cardarella* -* Set default Action Mailer options via config.action_mailer.default_options= *Robert Pankowecki* - ## Rails 3.2.5 (Jun 1, 2012) ## * No changes. diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index ea9a08102f..150d435140 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -278,6 +278,11 @@ module ActionMailer #:nodoc: # set something in the defaults using a proc, and then set the same thing inside of your # mailer method, it will get over written by the mailer method. # + # It is also possible to set these default options that will be used in all mailers through + # the <tt>default_options=</tt> configuration in <tt>config/application.rb</tt>: + # + # config.action_mailer.default_options = { from: "no-reply@example.org" } + # # = Callbacks # # You can specify callbacks using before_filter and after_filter for configuring your messages. @@ -421,8 +426,9 @@ module ActionMailer #:nodoc: self.default_params = default_params.merge(value).freeze if value default_params end - #Alias so that we can use it in config/application.rb which requires setters - #: config.action_mailer.default_options = {from: "no-replay@example.org"} + # Allows to set defaults through app configuration: + # + # config.action_mailer.default_options = { from: "no-reply@example.org" } alias :default_options= :default # Receives a raw email, parses it into an email object, decodes it, diff --git a/guides/source/4_0_release_notes.textile b/guides/source/4_0_release_notes.textile index 8415f6f83a..3733fec950 100644 --- a/guides/source/4_0_release_notes.textile +++ b/guides/source/4_0_release_notes.textile @@ -112,6 +112,8 @@ h4(#railties_deprecations). Deprecations h3. Action Mailer +* Allow to set default Action Mailer options via <tt>config.action_mailer.default_options=</tt>. + * Raise an <tt>ActionView::MissingTemplate</tt> exception when no implicit template could be found. * Asynchronously send messages via the Rails Queue. diff --git a/guides/source/configuring.textile b/guides/source/configuring.textile index d69235a9ab..cd9aab4892 100644 --- a/guides/source/configuring.textile +++ b/guides/source/configuring.textile @@ -424,12 +424,12 @@ There are a number of settings available on +config.action_mailer+: * +config.action_mailer.perform_deliveries+ specifies whether mail will actually be delivered and is true by default. It can be convenient to set it to false for testing. -* +config.action_mailer.default_options+ configures Action Mailer defaults. Use to set options like `from` or `replay_to` for every mailer. These default to: +* +config.action_mailer.default_options+ configures Action Mailer defaults. Use to set options like `from` or `reply_to` for every mailer. These default to: <ruby> :mime_version => "1.0", :charset => "UTF-8", :content_type => "text/plain", -:parts_order => [ "text/plain", "text/enriched", "text/html" ], +:parts_order => [ "text/plain", "text/enriched", "text/html" ] </ruby> * +config.action_mailer.observers+ registers observers which will be notified when mail is delivered. |