- Emails\Email
class Emails \ Email
Method Summary
Name | Description |
---|---|
compile($template_id, $arguments = array()) | |
phpmailer($to, $to_name, $subject, $message, $html_message = false) | TODO support HTML emails |
registerGlobalArgument($name, $callback) | This allows clients to add global variables to all emails sent. |
send($to_or_user, $template_id, $arguments = array()) |
Send an email with the given template to the given user or address. The subject of the e-mail is obtained from the first line of the text e-mail template, or the |
setMockMailer($mock) |
static function compile($template_id, $arguments = array())
- Defaults:
arguments
= array()
static function phpmailer($to, $to_name, $subject, $message, $html_message = false)
TODO support HTML emails
- Defaults:
html_message
=false
- Returns:
the sent message ID- Throws:
MailerException - if the mail could not be immediately sent
static function registerGlobalArgument($name, $callback)
This allows clients to add global variables to all emails sent.
- Parameters:
$callback
- callback function that returns an argument value, given the original $arguments as the first parameter
static function send($to_or_user, $template_id, $arguments = array())
Send an email with the given template to the given user or address. The subject of the e-mail is obtained from the first line of the text e-mail template, or the
of the HTML template. TODO support mock mailing TODO support i18n TODO service wrapper to allow emails to be queued
- Parameters:
$to_or_user
- either an email address, or something with getEmail() and optionally getName()- Defaults:
arguments
= array()- Returns:
the email result object, which is also sent to theemail_sent
event trigger- Throws:
MailerException - if the mail could not be immediately sent (e.g. technical error, invalid e-mail address...)
static function setMockMailer($mock)
- Parameters:
$mock
- a callback with arguments ($to_email, $to_name, $subject, $template, $html_template), ornull
to remove the mock mailer