--- !ruby/object:RI::ClassDescription 
attributes: 
- !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
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: register_template_extension
comment: 
- !ruby/struct:SM::Flow::P 
  body: ActionMailer 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 ActionMailer, 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     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 address. 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>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: 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 &quot;account&quot; =&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 ActionController, 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 for mailer views
- !ruby/struct:SM::Flow::P 
  body: "If your view includes URLs from the application, you need to use url_for in the mailing method instead of the view. Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request. That's why you need to jump this little hoop and supply all the details needed for the URL. Example:"
- !ruby/struct:SM::Flow::VERB 
  body: "   def signup_notification(recipient)\n     recipients recipient.email_address_with_name\n     from       &quot;system@example.com&quot;\n     subject    &quot;New account information&quot;\n     body       :account =&gt; recipient,\n                :home_page =&gt; url_for(:host =&gt; &quot;example.com&quot;, :controller =&gt; &quot;welcome&quot;, :action =&gt; &quot;greeting&quot;)\n   end\n"
- !ruby/struct:SM::Flow::P 
  body: You can now access @home_page in the template and get http://example.com/welcome/greeting.
- !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      body       &quot;account&quot; =&gt; recipient\n      from       &quot;system@example.com&quot;\n      content_type &quot;text/html&quot;   #    Here's where the magic happens\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\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 ActionMailer 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 same body hash is passed to each template.
- !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> - template root 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 :smtp 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 :plain, :login, :cram_md5
    type: :BULLET
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>sendmail_settings</tt> - Allows you to override options for the :sendmail 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 &quot;/usr/sbin/sendmail&quot;
    - !ruby/struct:SM::Flow::LI 
      label: "*"
      body: <tt>:arguments</tt> The command line arguments
    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 :smtp (default), :sendmail, and :test.
  - !ruby/struct:SM::Flow::LI 
    label: "*"
    body: <tt>perform_deliveries</tt> - Determines whether deliver_* 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 delivery_method :test. 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 &quot;1.0&quot;. 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 [&quot;text/html&quot;, &quot;text/enriched&quot;, &quot;text/plain&quot;]. 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: ActionController::UrlWriter
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
