lib/action_mailer/base.rb in actionmailer-1.1.2 vs lib/action_mailer/base.rb in actionmailer-1.1.3
- old
+ new
@@ -7,12 +7,12 @@
module ActionMailer
# Usage:
#
# class ApplicationMailer < ActionMailer::Base
# # Set up properties
- # # (Properties can also be specified via accessor methods
- # # i.e. self.subject = "foo") and instance variables (@subject = "foo").
+ # # Properties can also be specified via accessor methods
+ # # (i.e. self.subject = "foo") and instance variables (@subject = "foo").
# def signup_notification(recipient)
# recipients recipient.email_address_with_name
# subject "New account information"
# body { "account" => recipient }
# from "system@example.com"
@@ -69,11 +69,11 @@
# # with the corresponding content type. The same body hash is passed to
# # each template.
# end
# end
#
- # # After this post_notification will look for "templates/application_mailer/post_notification.rhtml"
+ # # After this, post_notification will look for "templates/application_mailer/post_notification.rhtml"
# ApplicationMailer.template_root = "templates"
#
# ApplicationMailer.create_comment_notification(david, hello_world) # => a tmail object
# ApplicationMailer.deliver_comment_notification(david, hello_world) # sends the email
#
@@ -85,15 +85,15 @@
#
# * <tt>logger</tt> - 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.
#
# * <tt>server_settings</tt> - Allows detailed configuration of the server:
- # * <tt>:address</tt> Allows you to use a remote mail server. Just change it away from it's default "localhost" setting.
- # * <tt>:port</tt> On the off change that your mail server doesn't run on port 25, you can change it.
+ # * <tt>:address</tt> Allows you to use a remote mail server. Just change it from its default "localhost" setting.
+ # * <tt>:port</tt> On the off chance that your mail server doesn't run on port 25, you can change it.
# * <tt>:domain</tt> If you need to specify a HELO domain, you can do it here.
- # * <tt>:user_name</tt> If your mail server requires authentication, set the username and password in these two settings.
- # * <tt>:password</tt> If your mail server requires authentication, set the username and password in these two settings.
+ # * <tt>:user_name</tt> If your mail server requires authentication, set the username in this setting.
+ # * <tt>:password</tt> If your mail server requires authentication, set the password in this setting.
# * <tt>:authentication</tt> If your mail server requires authentication, you need to specify the authentication type here.
# This is a symbol and one of :plain, :login, :cram_md5
#
# * <tt>raise_delivery_errors</tt> - whether or not errors should be raised if the email fails to be delivered.
#
@@ -106,16 +106,16 @@
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful
# for unit and functional testing.
#
# * <tt>default_charset</tt> - 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 <tt>@charset</tt>.
- # * <tt>default_content_type</tt> - The default content type used for main part of the message. Defaults to "text/plain". You
+ # * <tt>default_content_type</tt> - 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 <tt>@content_type</tt>.
# * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to nil. You
# can also pick a different value from inside a method with <tt>@mime_version</tt>. When multipart messages are in
# use, <tt>@mime_version</tt> will be set to "1.0" if it is not set inside a method.
- # * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assemble from templates
+ # * <tt>default_implicit_parts_order</tt> - 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
# <tt>@implicit_parts_order</tt>.
class Base
@@ -335,18 +335,17 @@
private
# Set up the default values for the various instance variables of this
# mailer. Subclasses may override this method to provide different
# defaults.
def initialize_defaults(method_name)
- @bcc = @cc = @from = @recipients = @sent_on = @subject = nil
- @charset = @@default_charset.dup
- @content_type = @@default_content_type.dup
- @implicit_parts_order = @@default_implicit_parts_order.dup
- @template = method_name
- @mailer_name = Inflector.underscore(self.class.name)
- @parts = []
- @headers = {}
- @body = {}
+ @charset ||= @@default_charset.dup
+ @content_type ||= @@default_content_type.dup
+ @implicit_parts_order ||= @@default_implicit_parts_order.dup
+ @template ||= method_name
+ @mailer_name ||= Inflector.underscore(self.class.name)
+ @parts ||= []
+ @headers ||= {}
+ @body ||= {}
@mime_version = @@default_mime_version.dup if @@default_mime_version
end
def render_message(method_name, body)
render :file => method_name, :body => body