Class Misago\ActionMailer\Base

Delivers emails.

Example

class Notifier extends Misago\ActionMailer\Base
{
  static function signup_notification($recipient)
  {
    $mail = new Misago\ActionMailer\Mail('signup_notification');
    $mail->from('me <me@domain>');
    $mail->to($recipient->email);
    $mail->body('account' => $recipient);
    return $mail;
  }
} 

Mail

See documentation of \Misago\ActionMailer\Mail for configuration methods.

Mail body

The body is just a view template. For instance:

To pass data from the ActionMailer to the view template, you may use the Misago\ActionMailer\Mail::body() method.

Please note that for the time being, it is necessary to have both the plain and html templates.

Layouts

You may render emails inside layouts. By default it searches for mailer's layouts, for instance layouts/user_mailer.html.tpl and layouts/user_mailer.plain.tpl for a UserMailer class.

You may also configure a per-class layout, using the $layout property. For instance the following class will user layouts/user_mailer.html.tpl and layouts/user_mailer.plain.tpl:

class UserMailer {
  protected $layout = 'email';
} 

Delivering

Simply call the deliver method:

$mail = Notifier::signup_notification($account);
Notifier::deliver($mail); 

There is also a magic shortcut:

Notifier::deliver_signup_notification($account); 

Configuration option

You may set the following configuration options (using cfg_set()).

Inheritence

Extends:
Misago

Public static attributes

Public instance attributes

Protected instance attributes

Methods

Public static methods

deliver($mail)

Delivers a prepared mail.

Protected static methods

render($mail)

Public instance methods

__construct()