Module: Padrino::Mailer::Helpers

Defined in:
padrino-mailer/lib/padrino-mailer/helpers.rb

Overview

Helpers for defining and delivering email messages.

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#deliver(mailer_name, message_name, *attributes) ⇒ Object

Delivers a mailer message email with the given attributes.

Examples:

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

Parameters:

  • mailer_name (Symbol)

    The name of the mailer.

  • message_name (Symbol)

    The name of the message to deliver.

  • attributes

    The parameters to pass to the mailer.

See Also:



48
49
50
# File 'padrino-mailer/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) ⇒ Object

Delivers an email with the given mail attributes.

Examples:

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

Parameters:

  • mail_attributes (Hash) (defaults to: {})

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

  • block (Proc)

    The block mail attributes for this message.

See Also:



29
30
31
# File 'padrino-mailer/lib/padrino-mailer/helpers.rb', line 29

def email(mail_attributes={}, &block)
  settings.email(mail_attributes, &block)
end