module Padrino::Mailer::Helpers

Helpers for defining and delivering email messages.

Public Class Methods

included(base) click to toggle source
# File lib/padrino-mailer/helpers.rb, line 7
def self.included(base) # @private
  base.extend(ClassMethods)
end

Public Instance Methods

deliver(mailer_name, message_name, *attributes) click to toggle source

Delivers a mailer message email with the given attributes.

@param [Symbol] mailer_name

The name of the mailer.

@param [Symbol] message_name

The name of the message to deliver.

@param attributes

The parameters to pass to the mailer.

@example

deliver(:sample, :birthday, "Joey", 21)
deliver(:example, :message, "John")

@see ClassMethods#deliver

# File lib/padrino-mailer/helpers.rb, line 48
def deliver(mailer_name, message_name, *attributes)
  settings.deliver(mailer_name, message_name, *attributes)
end
email(mail_attributes={}, &block) click to toggle source

Delivers an email with the given mail attributes.

@param [Hash] mail_attributes

The attributes for this message (to, from, subject, cc, bcc, body, etc).

@param [Proc] block

The block mail attributes for this message.

@example

email do
  to      @user.email
  from    "awesomeness@example.com"
  subject "Welcome to Awesomeness!"
  locals  :a => a, :b => b
  render  'path/to/my/template'
end

@see ClassMethods#email

# File lib/padrino-mailer/helpers.rb, line 29
def email(mail_attributes={}, &block)
  settings.email(mail_attributes, &block)
end