Brian’s Email class facilitates using SensioLab’s Swift Mailer as a mailing solution.


For ease of use, all normal email is sent through a method named “quick”. Configuration, which includes details regarding the recipient and sender can be passed as a parameter, or a parameter can point to an external configuration file.

Config as a Parameter

Here is an example using SMTP. You can also use sendmail and mail.

$params = array(
  'protocol'     => 'smtp',
  'smtp_host'    => '',
  'smtp_user'    => '',
  'smtp_pass'    => 'XxXxXxXxXxXx',
  'smtp_port'    => 25,
  'smtp_timeout' => 5,
  'from_email'   => '',
  'from_name'    => 'Example Website Name',
  'to'           => '',
  'view'         => 'email_templates/test',
  'view_data'    => '',
  'subject'      => 'Email test - ' . date( 'M d, Y' )

Email::quick( $params );

External Config

All of the external configs are held in config/email.php. You simply specify the key.

$params = array(
  'external_config' => 'example_config'

Email::quick( $params );