Module: Padrino::Mailer

### Home Classes Methods

### In Files

- lib/padrino-mailer.rb
- lib/padrino-mailer/base.rb
- lib/padrino-mailer/helpers.rb
- lib/padrino-mailer/mime.rb

### Namespace

- MODULE Padrino::Mailer::Helpers
- MODULE Padrino::Mailer::Mime
- CLASS Padrino::Mailer::Base

### Methods

- ::included
- ::registered

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Mailer
- Padrino::Mailer::Base
- Padrino::Mailer::Helpers
- Padrino::Mailer::Helpers::ClassMethods
- Padrino::Mailer::Mime
- Mail
- Mail::Message

No matching classes.

# Padrino::Mailer

This component uses the `mail` library to create a powerful but simple mailer within Padrino (and Sinatra). There is full support for using plain or html content-types as well as for file attachments.

Using the mailer in Padrino has two forms. The 'quick' method requires only use of the `email` method directly in the controller:

    # app/controllers/session.rb
    post :create do
      email do
        from "tony@reyes.com"
        to "john@smith.com"
        subject "Welcome!"
        body render('email/registered')
      end
    end

### Public Class Methods

included(app) click to toggle source
Alias for: registered
registered(app) click to toggle source

Registers the Padrino::Mailer helpers with the application.

@param [Sinatra::Application] app The application that needs mailers.

@example

    require 'padrino-mailer'
    class Demo < Padrino::Application
      register Padrino::Mailer::Helpers
    end

    # File lib/padrino-mailer.rb, line 39
    def registered(app)
      require 'padrino-mailer/base'
      require 'padrino-mailer/helpers'
      require 'padrino-mailer/mime'
      # This lazily loads the mail gem, due to its long require time.
      app.set :_padrino_mailer, proc {
        require 'mail'
        require 'padrino-mailer/ext'
        app._padrino_mailer = Mail
      }
      app.helpers Padrino::Mailer::Helpers
    end

Also aliased as: included

[Validate]

Generated with the Darkfish Rdoc Generator 2.