0
@@ -11,11 +11,11 @@ module ActionMailer #:nodoc:
0
# To use ActionMailer, you need to create a mailer model.
0
# $ script/generate mailer Notifier
0
- # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
0
- # used to set variables to be used in the mail template, to change options on the mail, or
0
+ # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
0
+ # used to set variables to be used in the mail template, to change options on the mail, or
0
@@ -48,7 +48,7 @@ module ActionMailer #:nodoc:
0
# named after each key in the hash containing the value that that key points to.
0
# So, for example, <tt>body :account => recipient</tt> would result
0
- # in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
0
+ # in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
0
@@ -57,7 +57,7 @@ module ActionMailer #:nodoc:
0
# Like ActionController, each mailer class has a corresponding view directory
0
# in which each method of the class looks for a template with its name.
0
# To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same name as the method
0
- # in your mailer model. For example, in the mailer defined above, the template at
0
+ # in your mailer model. For example, in the mailer defined above, the template at
0
# <tt>app/views/notifier/signup_notification.erb</tt> would be used to generate the email.
0
# Variables defined in the model are accessible as instance variables in the view.
0
@@ -71,48 +71,48 @@ module ActionMailer #:nodoc:
0
# <%= truncate(note.body, 25) %>
0
# URLs can be generated in mailer views using <tt>url_for</tt> or named routes.
0
- # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request,
0
- # so you'll need to provide all of the details needed to generate a URL.
0
+ # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request,
0
+ # so you'll need to provide all of the details needed to generate a URL.
0
# When using <tt>url_for</tt> you'll need to provide the <tt>:host</tt>, <tt>:controller</tt>, and <tt>:action</tt>:
0
# <%= url_for(:host => "example.com", :controller => "welcome", :action => "greeting") %>
0
# When using named routes you only need to supply the <tt>:host</tt>:
0
# <%= users_url(:host => "example.com") %>
0
# You will want to avoid using the <tt>name_of_route_path</tt> form of named routes because it doesn't make sense to
0
# generate relative URLs in email messages.
0
- # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt> option in
0
+ # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt> option in
0
# the <tt>ActionMailer::Base.default_url_options</tt> hash as follows:
0
# ActionMailer::Base.default_url_options[:host] = "example.com"
0
# This can also be set as a configuration option in <tt>config/environment.rb</tt>:
0
# config.action_mailer.default_url_options = { :host => "example.com" }
0
# If you do decide to set a default <tt>:host</tt> for your mailers you will want to use the
0
# <tt>:only_path => false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are generated because
0
- # the <tt>url_for</tt> view helper will, by default, generate relative URLs when a <tt>:host</tt> option isn't
0
+ # the <tt>url_for</tt> view helper will, by default, generate relative URLs when a <tt>:host</tt> option isn't
0
- # Once a mailer action and template are defined, you can deliver your message or create it and save it
0
+ # Once a mailer action and template are defined, you can deliver your message or create it and save it
0
# Notifier.deliver_signup_notification(david) # sends the email
0
# mail = Notifier.create_signup_notification(david) # => a tmail object
0
# Notifier.deliver(mail)
0
# You never instantiate your mailer class. Rather, your delivery instance
0
# methods are automatically wrapped in class methods that start with the word
0
# <tt>deliver_</tt> followed by the name of the mailer method that you would
0
@@ -133,7 +133,7 @@ module ActionMailer #:nodoc:
0
# from "system@example.com"
0
# content_type "text/html" # Here's where the magic happens
0
@@ -155,17 +155,17 @@ module ActionMailer #:nodoc:
0
# Multipart messages can also be used implicitly because ActionMailer will automatically
0
# detect and use multipart templates, where each template is named after the name of the action, followed
0
# by the content type. Each such detected template will be added as separate part to the message.
0
# For example, if the following templates existed:
0
# * signup_notification.text.plain.erb
0
# * signup_notification.text.html.erb
0
# * signup_notification.text.xml.builder
0
# * signup_notification.text.x-yaml.erb
0
# Each would be rendered and added as a separate part to the message,
0
# with the corresponding content type. The same body hash is passed to
0
@@ -191,7 +191,7 @@ module ActionMailer #:nodoc:
0
# a.body = generate_your_pdf_here()
0
# = Configuration options
0
@@ -209,7 +209,7 @@ module ActionMailer #:nodoc:
0
# * <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
0
# * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
0
# * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
0
- # * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here.
0
+ # * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here.
0
# This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>
0
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method
0
@@ -226,10 +226,10 @@ module ActionMailer #:nodoc:
0
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with <tt>delivery_method :test</tt>. Most useful
0
# for unit and functional testing.
0
- # * <tt>default_charset</tt> - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
0
+ # * <tt>default_charset</tt> - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
0
# pick a different charset from inside a method with <tt>@charset</tt>.
0
# * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
0
- # can also pick a different content type from inside a method with <tt>@content_type</tt>.
0
+ # can also pick a different content type from inside a method with <tt>@content_type</tt>.
0
# * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to "1.0". You
0
# can also pick a different value from inside a method with <tt>@mime_version</tt>.
0
# * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
0
@@ -249,16 +249,16 @@ module ActionMailer #:nodoc:
0
cattr_accessor :template_extensions
0
@@template_extensions = ['erb', 'builder', 'rhtml', 'rxml']
0
- :address => "localhost",
0
- :domain => 'localhost.localdomain',
0
+ :address => "localhost",
0
+ :domain => 'localhost.localdomain',
0
cattr_accessor :smtp_settings
0
@@sendmail_settings = {
0
:location => '/usr/sbin/sendmail',
0
@@ -270,10 +270,10 @@ module ActionMailer #:nodoc:
0
superclass_delegating_accessor :delivery_method
0
self.delivery_method = :smtp
0
@@perform_deliveries = true
0
cattr_accessor :perform_deliveries
0
cattr_accessor :deliveries
0
@@ -282,7 +282,7 @@ module ActionMailer #:nodoc:
0
@@default_content_type = "text/plain"
0
cattr_accessor :default_content_type
0
@@default_mime_version = "1.0"
0
cattr_accessor :default_mime_version
0
@@ -291,47 +291,47 @@ module ActionMailer #:nodoc:
0
# Specify the BCC addresses for the message
0
# Define the body of the message. This is either a Hash (in which case it
0
# specifies the variables to pass to the template when it is rendered),
0
# or a string, in which case it specifies the actual text of the message.
0
adv_attr_accessor :body
0
# Specify the CC addresses for the message.
0
# Specify the charset to use for the message. This defaults to the
0
# +default_charset+ specified for ActionMailer::Base.
0
adv_attr_accessor :charset
0
# Specify the content type for the message. This defaults to <tt>text/plain</tt>
0
# in most cases, but can be automatically set in some situations.
0
adv_attr_accessor :content_type
0
# Specify the from address for the message.
0
adv_attr_accessor :from
0
# Specify additional headers to be added to the message.
0
adv_attr_accessor :headers
0
# Specify the order in which parts should be sorted, based on content-type.
0
# This defaults to the value for the +default_implicit_parts_order+.
0
adv_attr_accessor :implicit_parts_order
0
# Defaults to "1.0", but may be explicitly given if needed.
0
adv_attr_accessor :mime_version
0
# The recipient addresses for the message, either as a string (for a single
0
# address) or an array (for multiple addresses).
0
adv_attr_accessor :recipients
0
# The date on which the message was sent. If not set (the default), the
0
# header will be set by the delivery agent.
0
adv_attr_accessor :sent_on
0
# Specify the subject of the message.
0
adv_attr_accessor :subject
0
# Specify the template name to use for current message. This is the "base"
0
# template name, without the extension or directory, and may be used to
0
# have multiple mailer methods share the same template.
0
@@ -347,7 +347,7 @@ module ActionMailer #:nodoc:
0
def mailer_name=(value)
0
self.class.mailer_name = value
0
@@ -425,7 +425,7 @@ module ActionMailer #:nodoc:
0
# remain uninitialized (useful when you only need to invoke the "receive"
0
# method, for instance).
0
def initialize(method_name=nil, *parameters) #:nodoc:
0
- create!(method_name, *parameters) if method_name
0
+ create!(method_name, *parameters) if method_name
0
# Initialize the mailer via the given +method_name+. The body will be
0
@@ -511,7 +511,7 @@ module ActionMailer #:nodoc:
0
@content_type ||= @@default_content_type.dup
0
@implicit_parts_order ||= @@default_implicit_parts_order.dup
0
@template ||= method_name
0
- @mailer_name ||= Inflector.underscore(self.class.name)
0
+ @mailer_name ||= self.class.name.underscore
0
@@ -597,7 +597,7 @@ module ActionMailer #:nodoc:
0
part = (TMail::Mail === p ? p : p.to_mail(self))
0
if real_content_type =~ /multipart/
0
ctype_attrs.delete "charset"
0
m.set_content_type(real_content_type, nil, ctype_attrs)
0
@@ -612,7 +612,7 @@ module ActionMailer #:nodoc:
0
sender = mail['return-path'] || mail.from
0
- Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
0
+ Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
0
smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
0
smtp.sendmail(mail.encoded, sender, destinations)
Comments
No one has commented yet.