From 0b05acd42439b197f71e168354020393cbf42b4f Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Tue, 26 Jan 2010 17:08:55 +1100 Subject: Implementing class level :defaults hash, instead of delivers_from et al --- actionmailer/lib/action_mailer/base.rb | 39 ++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 13 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 44df30b1ba..5adf4973b5 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -254,8 +254,8 @@ module ActionMailer #:nodoc: private_class_method :new #:nodoc: - extlib_inheritable_accessor :default_from - self.default_from = nil + extlib_inheritable_accessor :defaults + self.defaults = {} extlib_inheritable_accessor :default_charset self.default_charset = "utf-8" @@ -276,18 +276,13 @@ module ActionMailer #:nodoc: self.default_implicit_parts_order = [ "text/plain", "text/enriched", "text/html" ] class << self + def mailer_name @mailer_name ||= name.underscore end attr_writer :mailer_name alias :controller_path :mailer_name - # Sets who is the default sender for the e-mail - def delivers_from(value = nil) - self.default_from = value if value - self.default_from - end - # Receives a raw email, parses it into an email object, decodes it, # instantiates a new mailer, and passes the email object to the mailer # object's +receive+ method. If you want your mailer to be able to @@ -419,8 +414,7 @@ module ActionMailer #:nodoc: # humanized version of the action_name # * :to - Who the message is destined for, can be a string of addresses, or an array # of addresses. - # * :from - Who the message is from, if missing, will use the :delivers_from - # value in the class (if it exists) + # * :from - Who the message is from # * :cc - Who you would like to Carbon-Copy on this email, can be a string of addresses, # or an array of addresses. # * :bcc - Who you would like to Blind-Carbon-Copy on this email, can be a string of @@ -428,6 +422,15 @@ module ActionMailer #:nodoc: # * :reply_to - Who to set the Reply-To header of the email to. # * :date - The date to say the email was sent on. # + # You can set default values for any of the above headers (except :date) by using the defaults + # class method: + # + # class Notifier + # self.defaults = {:from => 'no-reply@test.lindsaar.net', + # :bcc => 'email_logger@test.lindsaar.net', + # :reply_to => 'bounces@test.lindsaar.net' } + # end + # # If you need other headers not listed above, use the headers['name'] = value method. # # When a :return_path is specified as header, that value will be used as the 'envelope from' @@ -478,8 +481,8 @@ module ActionMailer #:nodoc: mime_version = headers[:mime_version] || m.mime_version || self.class.default_mime_version.dup # Set fields quotings - headers[:subject] ||= default_subject - headers[:from] ||= self.class.default_from.dup + headers = set_defaults(headers) + quote_fields!(headers, charset) # Render the templates and blocks @@ -519,9 +522,19 @@ module ActionMailer #:nodoc: end end + def set_defaults(headers) + headers[:subject] ||= default_subject + headers[:to] ||= self.class.defaults[:to].to_s.dup + headers[:from] ||= self.class.defaults[:from].to_s.dup + headers[:cc] ||= self.class.defaults[:cc].to_s.dup + headers[:bcc] ||= self.class.defaults[:bcc].to_s.dup + headers[:reply_to] ||= self.class.defaults[:reply_to].to_s.dup + headers + end + def default_subject #:nodoc: mailer_scope = self.class.mailer_name.gsub('/', '.') - I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize) + self.class.defaults[:subject] || I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize) end # TODO: Move this into Mail -- cgit v1.2.3 From 9dd65c368b40093cfc686956a48c18b78abacf7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim=20and=20Mikel=20Lindsaar?= Date: Tue, 26 Jan 2010 11:21:20 +0100 Subject: Make defaults accept a hash. --- actionmailer/lib/action_mailer/base.rb | 78 ++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 37 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 5adf4973b5..dbaf1424ed 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -254,8 +254,13 @@ module ActionMailer #:nodoc: private_class_method :new #:nodoc: - extlib_inheritable_accessor :defaults - self.defaults = {} + extlib_inheritable_accessor :default_params + self.default_params = { + :mime_version => "1.0", + :charset => "utf-8", + :content_type => "text/plain", + :parts_order => [ "text/plain", "text/enriched", "text/html" ] + } extlib_inheritable_accessor :default_charset self.default_charset = "utf-8" @@ -283,6 +288,11 @@ module ActionMailer #:nodoc: attr_writer :mailer_name alias :controller_path :mailer_name + def defaults(value=nil) + self.default_params.merge!(value) if value + self.default_params + end + # Receives a raw email, parses it into an email object, decodes it, # instantiates a new mailer, and passes the email object to the mailer # object's +receive+ method. If you want your mailer to be able to @@ -425,10 +435,10 @@ module ActionMailer #:nodoc: # You can set default values for any of the above headers (except :date) by using the defaults # class method: # - # class Notifier - # self.defaults = {:from => 'no-reply@test.lindsaar.net', - # :bcc => 'email_logger@test.lindsaar.net', - # :reply_to => 'bounces@test.lindsaar.net' } + # class Notifier < ActionMailer::Base + # self.defaults :from => 'no-reply@test.lindsaar.net', + # :bcc => 'email_logger@test.lindsaar.net', + # :reply_to => 'bounces@test.lindsaar.net' # end # # If you need other headers not listed above, use the headers['name'] = value method. @@ -475,40 +485,46 @@ module ActionMailer #:nodoc: @mail_was_called = true m = @_message - # Give preference to headers and fallback to the ones set in mail - content_type = headers[:content_type] || m.content_type - charset = headers[:charset] || m.charset || self.class.default_charset.dup - mime_version = headers[:mime_version] || m.mime_version || self.class.default_mime_version.dup + # At the beginning, do not consider class default for parts order neither content_type + content_type = headers[:content_type] + parts_order = headers[:parts_order] - # Set fields quotings - headers = set_defaults(headers) + # Merge defaults from class + headers = headers.reverse_merge(self.class.defaults) + charset = headers[:charset] + # Quote fields + headers[:subject] ||= default_i18n_subject quote_fields!(headers, charset) # Render the templates and blocks - responses, sort_order = collect_responses_and_sort_order(headers, &block) - + responses, explicit_order = collect_responses_and_sort_order(headers, &block) create_parts_from_responses(m, responses, charset) - # Tidy up content type, charset, mime version and sort order - m.content_type = set_content_type(m, content_type) + # Finally setup content type and parts order + m.content_type = set_content_type(m, content_type, headers[:content_type]) m.charset = charset - m.mime_version = mime_version - sort_order = headers[:parts_order] || sort_order || self.class.default_implicit_parts_order.dup if m.multipart? - m.body.set_sort_order(sort_order) + parts_order ||= explicit_order || headers[:parts_order] + m.body.set_sort_order(parts_order) m.body.sort_parts! end - # Finaly set delivery behavior configured in class + # Set configure delivery behavior wrap_delivery_behavior!(headers[:delivery_method]) + + # Remove headers already treated and assign all others + headers.except!(:subject, :to, :from, :cc, :bcc, :reply_to) + headers.except!(:body, :parts_order, :content_type, :charset, :delivery_method) + headers.each { |k, v| m[k] = v } + m end protected - def set_content_type(m, user_content_type) + def set_content_type(m, user_content_type, class_default) params = m.content_type_parameters || {} case when user_content_type.present? @@ -518,23 +534,13 @@ module ActionMailer #:nodoc: when m.multipart? ["multipart", "alternative", params] else - self.class.default_content_type.dup + class_default end end - def set_defaults(headers) - headers[:subject] ||= default_subject - headers[:to] ||= self.class.defaults[:to].to_s.dup - headers[:from] ||= self.class.defaults[:from].to_s.dup - headers[:cc] ||= self.class.defaults[:cc].to_s.dup - headers[:bcc] ||= self.class.defaults[:bcc].to_s.dup - headers[:reply_to] ||= self.class.defaults[:reply_to].to_s.dup - headers - end - - def default_subject #:nodoc: + def default_i18n_subject #:nodoc: mailer_scope = self.class.mailer_name.gsub('/', '.') - self.class.defaults[:subject] || I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize) + I18n.t(:subject, :scope => [:actionmailer, mailer_scope, action_name], :default => action_name.humanize) end # TODO: Move this into Mail @@ -546,7 +552,6 @@ module ActionMailer #:nodoc: m.cc ||= quote_address_if_necessary(headers[:cc], charset) if headers[:cc] m.bcc ||= quote_address_if_necessary(headers[:bcc], charset) if headers[:bcc] m.reply_to ||= quote_address_if_necessary(headers[:reply_to], charset) if headers[:reply_to] - m.date ||= headers[:date] if headers[:date] end def collect_responses_and_sort_order(headers) #:nodoc: @@ -588,8 +593,7 @@ module ActionMailer #:nodoc: def create_parts_from_responses(m, responses, charset) #:nodoc: if responses.size == 1 && !m.has_attachments? - headers = responses[0] - headers.each { |k,v| m[k] = v } + responses[0].each { |k,v| m[k] = v } return responses[0][:content_type] elsif responses.size > 1 && m.has_attachments? container = Mail::Part.new -- cgit v1.2.3 From 39a1b06f13221e00ab38dff960155cb5fe9eaabb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim=20and=20Mikel=20Lindsaar?= Date: Tue, 26 Jan 2010 11:46:42 +0100 Subject: Deprecate old defaults API. --- actionmailer/lib/action_mailer/base.rb | 31 +++++----------------- actionmailer/lib/action_mailer/delivery_methods.rb | 5 +++- actionmailer/lib/action_mailer/deprecated_api.rb | 29 ++++++++++++++++++-- actionmailer/lib/action_mailer/old_api.rb | 10 ++++--- 4 files changed, 43 insertions(+), 32 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index dbaf1424ed..95c45ec54b 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -262,24 +262,6 @@ module ActionMailer #:nodoc: :parts_order => [ "text/plain", "text/enriched", "text/html" ] } - extlib_inheritable_accessor :default_charset - self.default_charset = "utf-8" - - extlib_inheritable_accessor :default_content_type - self.default_content_type = "text/plain" - - extlib_inheritable_accessor :default_mime_version - self.default_mime_version = "1.0" - - # This specifies the order that the parts of a multipart email will be. Usually you put - # text/plain at the top so someone without a MIME capable email reader can read the plain - # text of your email first. - # - # Any content type that is not listed here will be inserted in the order you add them to - # the email after the content types you list here. - extlib_inheritable_accessor :default_implicit_parts_order - self.default_implicit_parts_order = [ "text/plain", "text/enriched", "text/html" ] - class << self def mailer_name @@ -498,7 +480,7 @@ module ActionMailer #:nodoc: quote_fields!(headers, charset) # Render the templates and blocks - responses, explicit_order = collect_responses_and_sort_order(headers, &block) + responses, explicit_order = collect_responses_and_parts_order(headers, &block) create_parts_from_responses(m, responses, charset) # Finally setup content type and parts order @@ -554,18 +536,18 @@ module ActionMailer #:nodoc: m.reply_to ||= quote_address_if_necessary(headers[:reply_to], charset) if headers[:reply_to] end - def collect_responses_and_sort_order(headers) #:nodoc: - responses, sort_order = [], nil + def collect_responses_and_parts_order(headers) #:nodoc: + responses, parts_order = [], nil if block_given? collector = ActionMailer::Collector.new(self) { render(action_name) } yield(collector) - sort_order = collector.responses.map { |r| r[:content_type] } + parts_order = collector.responses.map { |r| r[:content_type] } responses = collector.responses elsif headers[:body] responses << { :body => headers[:body], - :content_type => self.class.default_content_type.dup + :content_type => self.class.defaults[:content_type] || "text/plain" } else each_template do |template| @@ -576,7 +558,7 @@ module ActionMailer #:nodoc: end end - [responses, sort_order] + [responses, parts_order] end def each_template(&block) #:nodoc: @@ -594,7 +576,6 @@ module ActionMailer #:nodoc: def create_parts_from_responses(m, responses, charset) #:nodoc: if responses.size == 1 && !m.has_attachments? responses[0].each { |k,v| m[k] = v } - return responses[0][:content_type] elsif responses.size > 1 && m.has_attachments? container = Mail::Part.new container.content_type = "multipart/alternative" diff --git a/actionmailer/lib/action_mailer/delivery_methods.rb b/actionmailer/lib/action_mailer/delivery_methods.rb index 34bfe6000a..f6321a240c 100644 --- a/actionmailer/lib/action_mailer/delivery_methods.rb +++ b/actionmailer/lib/action_mailer/delivery_methods.rb @@ -65,7 +65,10 @@ module ActionMailer method ||= self.delivery_method mail.delivery_handler = self - if method.is_a?(Symbol) + case method + when NilClass + raise "Delivery method cannot be nil" + when Symbol if klass = delivery_methods[method.to_sym] mail.delivery_method(klass, send(:"#{method}_settings")) else diff --git a/actionmailer/lib/action_mailer/deprecated_api.rb b/actionmailer/lib/action_mailer/deprecated_api.rb index 0eb8d85676..61101c26a1 100644 --- a/actionmailer/lib/action_mailer/deprecated_api.rb +++ b/actionmailer/lib/action_mailer/deprecated_api.rb @@ -5,8 +5,25 @@ module ActionMailer module DeprecatedApi #:nodoc: extend ActiveSupport::Concern - module ClassMethods + included do + [:charset, :content_type, :mime_version, :implicit_parts_order].each do |method| + class_eval <<-FILE, __FILE__, __LINE__ + 1 + def self.default_#{method} + @@default_#{method} + end + + def self.default_#{method}=(value) + ActiveSupport::Deprecation.warn "ActionMailer::Base.default_#{method}=value is deprecated, " << + "use defaults :#{method} => value instead" + @@default_#{method} = value + end + + @@default_#{method} = nil + FILE + end + end + module ClassMethods # Deliver the given mail object directly. This can be used to deliver # a preconstructed mail object, like: # @@ -99,7 +116,15 @@ module ActionMailer end private - + + def initialize_defaults(*) + @charset ||= self.class.default_charset.try(:dup) + @content_type ||= self.class.default_content_type.try(:dup) + @implicit_parts_order ||= self.class.default_implicit_parts_order.try(:dup) + @mime_version ||= self.class.default_mime_version.try(:dup) + super + end + def create_parts if @body.is_a?(Hash) && !@body.empty? ActiveSupport::Deprecation.warn "Giving a hash to body is deprecated, please use instance variables instead", caller[0,2] diff --git a/actionmailer/lib/action_mailer/old_api.rb b/actionmailer/lib/action_mailer/old_api.rb index f5b077ab98..22c3c518b1 100644 --- a/actionmailer/lib/action_mailer/old_api.rb +++ b/actionmailer/lib/action_mailer/old_api.rb @@ -1,3 +1,5 @@ +require 'active_support/core_ext/object/try' + module ActionMailer module OldApi #:nodoc: extend ActiveSupport::Concern @@ -185,10 +187,10 @@ module ActionMailer # mailer. Subclasses may override this method to provide different # defaults. def initialize_defaults(method_name) - @charset ||= self.class.default_charset.dup - @content_type ||= self.class.default_content_type.dup - @implicit_parts_order ||= self.class.default_implicit_parts_order.dup - @mime_version ||= self.class.default_mime_version.dup if self.class.default_mime_version + @charset ||= self.class.defaults[:charset].try(:dup) + @content_type ||= self.class.defaults[:content_type].try(:dup) + @implicit_parts_order ||= self.class.defaults[:parts_order].try(:dup) + @mime_version ||= self.class.defaults[:mime_version].try(:dup) @mailer_name ||= self.class.mailer_name.dup @template ||= method_name -- cgit v1.2.3 From 9520166f70b84dd56640b7dbe8e3737c91e04bd9 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Wed, 27 Jan 2010 00:06:19 +1100 Subject: Fixed up being able to pass random headers in with headers, or mail. Also, undeprecated headers(hash) as this works now too --- actionmailer/lib/action_mailer/base.rb | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index dbaf1424ed..c01ca876dc 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -40,13 +40,17 @@ module ActionMailer #:nodoc: # * headers[]= - Allows you to specify non standard headers in your email such # as headers['X-No-Spam'] = 'True' # + # * headers(hash) - Allows you to specify multiple headers in your email such + # as headers({'X-No-Spam' => 'True', 'In-Reply-To' => '1234@message.id'}) + # # * mail - Allows you to specify your email to send. # - # The hash passed to the mail method allows you to specify the most used headers in an email - # message, such as Subject, To, From, Cc, Bcc, - # Reply-To and Date. See the ActionMailer#mail method for more details. - # - # If you need other headers not listed above, use the headers['name'] = value method. + # The hash passed to the mail method allows you to specify any header that a Mail::Message + # will accept (any valid Email header including optional fields). Obviously if you specify + # the same header in the headers method and then again in the mail method, the last one + # will over write the first, unless you are specifying a header field that can appear more + # than once per RFC, in which case, both will be inserted (X-value headers for example can + # appear multiple times.) # # The mail method, if not passed a block, will inspect your views and send all the views with # the same name as the method, so the above action would send the +welcome.plain.erb+ view file @@ -263,13 +267,13 @@ module ActionMailer #:nodoc: } extlib_inheritable_accessor :default_charset - self.default_charset = "utf-8" + self.default_charset = self.default_params[:charset] extlib_inheritable_accessor :default_content_type - self.default_content_type = "text/plain" + self.default_content_type = self.default_params[:content_type] extlib_inheritable_accessor :default_mime_version - self.default_mime_version = "1.0" + self.default_mime_version = self.default_params[:mime_version] # This specifies the order that the parts of a multipart email will be. Usually you put # text/plain at the top so someone without a MIME capable email reader can read the plain @@ -278,7 +282,7 @@ module ActionMailer #:nodoc: # Any content type that is not listed here will be inserted in the order you add them to # the email after the content types you list here. extlib_inheritable_accessor :default_implicit_parts_order - self.default_implicit_parts_order = [ "text/plain", "text/enriched", "text/html" ] + self.default_implicit_parts_order = self.default_params[:parts_order] class << self @@ -366,13 +370,18 @@ module ActionMailer #:nodoc: # # headers['X-Special-Domain-Specific-Header'] = "SecretValue" # + # You can also pass a hash into headers of header field names and values, which + # will then be set on the Mail::Message object: + # + # headers {'X-Special-Domain-Specific-Header' => "SecretValue", + # 'In-Reply-To' => incoming.message_id } + # # The resulting Mail::Message will have the following in it's header: # # X-Special-Domain-Specific-Header: SecretValue def headers(args=nil) if args - ActiveSupport::Deprecation.warn "headers(Hash) is deprecated, please do headers[key] = value instead", caller[0,2] - @headers = args + @_message.headers(args) else @_message end -- cgit v1.2.3 From 21dcc20ed29053c8ffd4d3a5a68a40f6e225512b Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Wed, 27 Jan 2010 00:18:40 +1100 Subject: Fixed up documentation to reflect code change and cleaned up tests of spurious #deliver calls --- actionmailer/lib/action_mailer/base.rb | 40 ++++++++++++++++------------------ 1 file changed, 19 insertions(+), 21 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index c01ca876dc..868d785129 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -23,7 +23,7 @@ module ActionMailer #:nodoc: # Examples: # # class Notifier < ActionMailer::Base - # delivers_from 'system@example.com' + # defaults({:from => 'system@example.com'}) # # def welcome(recipient) # @account = recipient @@ -190,9 +190,14 @@ module ActionMailer #:nodoc: # # These options are specified on the class level, like ActionMailer::Base.template_root = "/my/templates" # - # * delivers_from - Pass this the address that then defaults as the +from+ address on all the - # emails sent. Can be overridden on a per mail basis by passing :from => 'another@address' in - # the +mail+ method. + # * defaults - This is a class wide hash of :key => value pairs containing + # default values for the specified header fields of the Mail::Message. You can + # specify a default for any valid header for Mail::Message and it will be used if + # you do not override it. The defaults set by Action Mailer are: + # * :mime_version => "1.0" + # * :charset => "utf-8", + # * :content_type => "text/plain", + # * :parts_order => [ "text/plain", "text/enriched", "text/html" ] # # * logger - the logger is used for generating information on the mailing run if available. # Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers. @@ -226,20 +231,19 @@ module ActionMailer #:nodoc: # * deliveries - Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful # for unit and functional testing. # - # * default_charset - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also - # pick a different charset from inside a method with +charset+. + # * default_charset - This is now deprecated, use the +defaults+ method above to + # set the default +:charset+. # - # * default_content_type - The default content type used for the main part of the message. Defaults to "text/plain". You - # can also pick a different content type from inside a method with +content_type+. + # * default_content_type - This is now deprecated, use the +defaults+ method above + # to set the default +:content_type+. # - # * default_mime_version - The default mime version used for the message. Defaults to 1.0. You - # can also pick a different value from inside a method with +mime_version+. + # * default_mime_version - This is now deprecated, use the +defaults+ method above + # to set the default +:mime_version+. # - # * default_implicit_parts_order - When a message is built implicitly (i.e. multiple parts are assembled from templates - # which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to - # ["text/html", "text/enriched", "text/plain"]. Items that appear first in the array have higher priority in the mail client - # and appear last in the mime encoded message. You can also pick a different order from inside a method with - # +implicit_parts_order+. + # * default_implicit_parts_order - This is now deprecated, use the +defaults+ method above + # to set the default +:parts_order+. Parts Order is used when a message is built implicitly + # (i.e. multiple parts are assembled from templates which specify the content type in their + # filenames) this variable controls how the parts are ordered. class Base < AbstractController::Base include DeliveryMethods, Quoting abstract! @@ -275,12 +279,6 @@ module ActionMailer #:nodoc: extlib_inheritable_accessor :default_mime_version self.default_mime_version = self.default_params[:mime_version] - # This specifies the order that the parts of a multipart email will be. Usually you put - # text/plain at the top so someone without a MIME capable email reader can read the plain - # text of your email first. - # - # Any content type that is not listed here will be inserted in the order you add them to - # the email after the content types you list here. extlib_inheritable_accessor :default_implicit_parts_order self.default_implicit_parts_order = self.default_params[:parts_order] -- cgit v1.2.3 From ccea6ab07d38c5bc2de341c3f08d199ef55bccc6 Mon Sep 17 00:00:00 2001 From: Mikel Lindsaar Date: Wed, 27 Jan 2010 00:37:22 +1100 Subject: Fixing up tests and docs to use defaults :from => 'name' instead of defaults({:from => 'name'}) --- actionmailer/lib/action_mailer/base.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index f677ab629e..669e49c91c 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -23,7 +23,8 @@ module ActionMailer #:nodoc: # Examples: # # class Notifier < ActionMailer::Base - # defaults({:from => 'system@example.com'}) + # defaults :from => 'no-reply@example.com', + # :return_path => 'system@example.com' # # def welcome(recipient) # @account = recipient -- cgit v1.2.3 From 05c4ad9d3f6ff8d0017f4bca9b52e552629c4813 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim=20and=20Mikel=20Lindsaar?= Date: Tue, 26 Jan 2010 16:00:24 +0100 Subject: Tidy up tests and docs. --- actionmailer/lib/action_mailer/base.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'actionmailer/lib') diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb index 669e49c91c..b230e34631 100644 --- a/actionmailer/lib/action_mailer/base.rb +++ b/actionmailer/lib/action_mailer/base.rb @@ -360,8 +360,8 @@ module ActionMailer #:nodoc: # You can also pass a hash into headers of header field names and values, which # will then be set on the Mail::Message object: # - # headers {'X-Special-Domain-Specific-Header' => "SecretValue", - # 'In-Reply-To' => incoming.message_id } + # headers 'X-Special-Domain-Specific-Header' => "SecretValue", + # 'In-Reply-To' => incoming.message_id # # The resulting Mail::Message will have the following in it's header: # -- cgit v1.2.3