--- !ruby/object:RI::ClassDescription 
attributes: 
- !ruby/object:RI::Attribute 
  comment: 
  name: action_name
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  name: default_template_name
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  - !ruby/struct:SM::Flow::P 
    body: The mail object instance referenced by this mailer.
  name: mail
  rw: R
- !ruby/object:RI::Attribute 
  comment: 
  name: mailer_name
  rw: W
- !ruby/object:RI::Attribute 
  comment: 
  name: template_name
  rw: R
class_methods: 
- !ruby/object:RI::MethodSummary 
  name: deliver
- !ruby/object:RI::MethodSummary 
  name: mailer_name
- !ruby/object:RI::MethodSummary 
  name: receive
- !ruby/object:RI::MethodSummary 
  name: template_root
- !ruby/object:RI::MethodSummary 
  name: template_root=
comment: 
- !ruby/struct:SM::Flow::P 
  body: Action Mailer allows you to send email from your application using a mailer model and views.
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Mailer Models
- !ruby/struct:SM::Flow::P 
  body: To use Action Mailer, you need to create a mailer model.
- !ruby/struct:SM::Flow::VERB 
  body: "  $ script/generate mailer Notifier\n"
- !ruby/struct:SM::Flow::P 
  body: The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then used to set variables to be used in the mail template, to change options on the mail, or to add attachments.
- !ruby/struct:SM::Flow::P 
  body: "Examples:"
- !ruby/struct:SM::Flow::VERB 
  body: " class Notifier &lt; ActionMailer::Base\n   def signup_notification(recipient)\n     recipients recipient.email_address_with_name\n     bcc        [&quot;bcc@example.com&quot;, &quot;Order Watcher &lt;watcher@example.com&gt;&quot;]\n     from       &quot;system@example.com&quot;\n     subject    &quot;New account information&quot;\n     body       :account =&gt; recipient\n   end\n end\n"
- !ruby/struct:SM::Flow::P 
  body: Mailer methods have the following configuration methods available.
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>recipients</tt> - Takes one or more email addresses. These addresses are where your email will be delivered to. Sets the <tt>To:</tt> header.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>subject</tt> - The subject of your email. Sets the <tt>Subject:</tt> header.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>from</tt> - Who the email you are sending is from. Sets the <tt>From:</tt> header.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>cc</tt> - Takes one or more email addresses. These addresses will receive a carbon copy of your email. Sets the <tt>Cc:</tt> header.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>bcc</tt> - Takes one or more email addresses. These addresses will receive a blind carbon copy of your email. Sets the <tt>Bcc:</tt> header.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>reply_to</tt> - Takes one or more email addresses. These addresses will be listed as the default recipients when replying to your email. Sets the <tt>Reply-To:</tt> header.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>sent_on</tt> - The date on which the message was sent. If not set, the header wil be set by the delivery agent.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>content_type</tt> - Specify the content type of the message. Defaults to <tt>text/plain</tt>.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>headers</tt> - Specify additional headers to be set for the message, e.g. <tt>headers 'X-Mail-Count' =&gt; 107370</tt>.
  type: :BULLET
- !ruby/struct:SM::Flow::P 
  body: When a <tt>headers 'return-path'</tt> is specified, that value will be used as the 'envelope from' address. Setting this is useful when you want delivery notifications sent to a different address than the one in <tt>from</tt>.
- !ruby/struct:SM::Flow::P 
  body: The <tt>body</tt> method has special behavior. It takes a hash which generates an instance variable named after each key in the hash containing the value that that key points to.
- !ruby/struct:SM::Flow::P 
  body: So, for example, <tt>body :account =&gt; recipient</tt> would result in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the view.
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Mailer views
- !ruby/struct:SM::Flow::P 
  body: Like Action Controller, each mailer class has a corresponding view directory in which each method of the class looks for a template with its name. To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same name as the method in your mailer model. For example, in the mailer defined above, the template at <tt>app/views/notifier/signup_notification.erb</tt> would be used to generate the email.
- !ruby/struct:SM::Flow::P 
  body: Variables defined in the model are accessible as instance variables in the view.
- !ruby/struct:SM::Flow::P 
  body: "Emails by default are sent in plain text, so a sample view for our model example might look like this:"
- !ruby/struct:SM::Flow::VERB 
  body: "  Hi &lt;%= @account.name %&gt;,\n  Thanks for joining our service! Please check back often.\n"
- !ruby/struct:SM::Flow::P 
  body: "You can even use Action Pack helpers in these views. For example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  You got a new note!\n  &lt;%= truncate(note.body, 25) %&gt;\n"
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Generating URLs
- !ruby/struct:SM::Flow::P 
  body: URLs can be generated in mailer views using <tt>url_for</tt> or named routes. Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request, so you'll need to provide all of the details needed to generate a URL.
- !ruby/struct:SM::Flow::P 
  body: "When using <tt>url_for</tt> you'll need to provide the <tt>:host</tt>, <tt>:controller</tt>, and <tt>:action</tt>:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= url_for(:host =&gt; &quot;example.com&quot;, :controller =&gt; &quot;welcome&quot;, :action =&gt; &quot;greeting&quot;) %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: "When using named routes you only need to supply the <tt>:host</tt>:"
- !ruby/struct:SM::Flow::VERB 
  body: "  &lt;%= users_url(:host =&gt; &quot;example.com&quot;) %&gt;\n"
- !ruby/struct:SM::Flow::P 
  body: You will want to avoid using the <tt>name_of_route_path</tt> form of named routes because it doesn't make sense to generate relative URLs in email messages.
- !ruby/struct:SM::Flow::P 
  body: "It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt> option in the <tt>ActionMailer::Base.default_url_options</tt> hash as follows:"
- !ruby/struct:SM::Flow::VERB 
  body: "  ActionMailer::Base.default_url_options[:host] = &quot;example.com&quot;\n"
- !ruby/struct:SM::Flow::P 
  body: "This can also be set as a configuration option in <tt>config/environment.rb</tt>:"
- !ruby/struct:SM::Flow::VERB 
  body: "  config.action_mailer.default_url_options = { :host =&gt; &quot;example.com&quot; }\n"
- !ruby/struct:SM::Flow::P 
  body: If you do decide to set a default <tt>:host</tt> for your mailers you will want to use the <tt>:only_path =&gt; false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are generated because the <tt>url_for</tt> view helper will, by default, generate relative URLs when a <tt>:host</tt> option isn't explicitly provided.
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Sending mail
- !ruby/struct:SM::Flow::P 
  body: "Once a mailer action and template are defined, you can deliver your message or create it and save it for delivery later:"
- !ruby/struct:SM::Flow::VERB 
  body: "  Notifier.deliver_signup_notification(david) # sends the email\n  mail = Notifier.create_signup_notification(david)  # =&gt; a tmail object\n  Notifier.deliver(mail)\n"
- !ruby/struct:SM::Flow::P 
  body: You never instantiate your mailer class. Rather, your delivery instance methods are automatically wrapped in class methods that start with the word <tt>deliver_</tt> followed by the name of the mailer method that you would like to deliver. The <tt>signup_notification</tt> method defined above is delivered by invoking <tt>Notifier.deliver_signup_notification</tt>.
- !ruby/struct:SM::Flow::H 
  level: 1
  text: HTML email
- !ruby/struct:SM::Flow::P 
  body: To send mail as HTML, make sure your view (the <tt>.erb</tt> file) generates HTML and set the content type to html.
- !ruby/struct:SM::Flow::VERB 
  body: "  class MyMailer &lt; ActionMailer::Base\n    def signup_notification(recipient)\n      recipients   recipient.email_address_with_name\n      subject      &quot;New account information&quot;\n      from         &quot;system@example.com&quot;\n      body         :account =&gt; recipient\n      content_type &quot;text/html&quot;\n    end\n  end\n"
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Multipart email
- !ruby/struct:SM::Flow::P 
  body: "You can explicitly specify multipart messages:"
- !ruby/struct:SM::Flow::VERB 
  body: "  class ApplicationMailer &lt; ActionMailer::Base\n    def signup_notification(recipient)\n      recipients      recipient.email_address_with_name\n      subject         &quot;New account information&quot;\n      from            &quot;system@example.com&quot;\n      content_type    &quot;multipart/alternative&quot;\n\n      part :content_type =&gt; &quot;text/html&quot;,\n        :body =&gt; render_message(&quot;signup-as-html&quot;, :account =&gt; recipient)\n\n      part &quot;text/plain&quot; do |p|\n        p.body = render_message(&quot;signup-as-plain&quot;, :account =&gt; recipient)\n        p.transfer_encoding = &quot;base64&quot;\n      end\n    end\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: Multipart messages can also be used implicitly because Action Mailer will automatically detect and use multipart templates, where each template is named after the name of the action, followed by the content type. Each such detected template will be added as separate part to the message.
- !ruby/struct:SM::Flow::P 
  body: "For example, if the following templates existed:"
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: signup_notification.text.plain.erb
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: signup_notification.text.html.erb
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: signup_notification.text.xml.builder
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: signup_notification.text.x-yaml.erb
  type: :BULLET
- !ruby/struct:SM::Flow::P 
  body: Each would be rendered and added as a separate part to the message, with the corresponding content type. The content type for the entire message is automatically set to <tt>multipart/alternative</tt>, which indicates that the email contains multiple different representations of the same email body. The same body hash is passed to each template.
- !ruby/struct:SM::Flow::P 
  body: Implicit template rendering is not performed if any attachments or parts have been added to the email. This means that you'll have to manually add each part to the email and set the content type of the email to <tt>multipart/alternative</tt>.
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Attachments
- !ruby/struct:SM::Flow::P 
  body: Attachments can be added by using the <tt>attachment</tt> method.
- !ruby/struct:SM::Flow::P 
  body: "Example:"
- !ruby/struct:SM::Flow::VERB 
  body: "  class ApplicationMailer &lt; ActionMailer::Base\n    # attachments\n    def signup_notification(recipient)\n      recipients      recipient.email_address_with_name\n      subject         &quot;New account information&quot;\n      from            &quot;system@example.com&quot;\n\n      attachment :content_type =&gt; &quot;image/jpeg&quot;,\n        :body =&gt; File.read(&quot;an-image.jpg&quot;)\n\n      attachment &quot;application/pdf&quot; do |a|\n        a.body = generate_your_pdf_here()\n      end\n    end\n  end\n"
- !ruby/struct:SM::Flow::H 
  level: 1
  text: Configuration options
- !ruby/struct:SM::Flow::P 
  body: These options are specified on the class level, like <tt>ActionMailer::Base.template_root = &quot;/my/templates&quot;</tt>
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>template_root</tt> - Determines the base from which template references will be made.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <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.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: "<tt>smtp_settings</tt> - Allows detailed configuration for <tt>:smtp</tt> delivery method:"
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default &quot;localhost&quot; setting.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server and starts to use it. It works only on Ruby &gt;= 1.8.7 and Ruby &gt;= 1.9. Default is true.
    type: :BULLET
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
  - !ruby/object:SM::Flow::LIST 
    contents: 
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt>.
    type: :BULLET
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>raise_delivery_errors</tt> - Whether or not errors should be raised if the email fails to be delivered.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>delivery_method</tt> - Defines a delivery method. Possible values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, and <tt>:test</tt>.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>perform_deliveries</tt> - Determines whether <tt>deliver_*</tt> methods are actually carried out. By default they are, but this can be turned off to help functional testing.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with <tt>delivery_method :test</tt>. Most useful for unit and functional testing.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <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>.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to &quot;text/plain&quot;. You can also pick a different content type from inside a method with <tt>content_type</tt>.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to <tt>1.0</tt>. You can also pick a different value from inside a method with <tt>mime_version</tt>.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <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 <tt>[&quot;text/html&quot;, &quot;text/enriched&quot;, &quot;text/plain&quot;]</tt>. 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>.
  type: :BULLET
constants: []

full_name: ActionMailer::Base
includes: 
- !ruby/object:RI::IncludedModule 
  name: AdvAttrAccessor
- !ruby/object:RI::IncludedModule 
  name: PartContainer
- !ruby/object:RI::IncludedModule 
  name: Quoting
- !ruby/object:RI::IncludedModule 
  name: Utils
- !ruby/object:RI::IncludedModule 
  name: ActionController::UrlWriter
- !ruby/object:RI::IncludedModule 
  name: ActionController::Layout
instance_methods: 
- !ruby/object:RI::MethodSummary 
  name: controller_name
- !ruby/object:RI::MethodSummary 
  name: controller_path
- !ruby/object:RI::MethodSummary 
  name: deliver!
- !ruby/object:RI::MethodSummary 
  name: mailer_name
- !ruby/object:RI::MethodSummary 
  name: mailer_name=
name: Base
superclass: Object
