Mailer

Send out mails

Functions

Mailer::send

Definition

Name
Mailer::send
Shorthand
mailer()->send()
Syntax
Object|false = Mailer::send( [Array|false $_options ] );

Description

Sends an email.

Parameters

$_options
Array|False
Options
subject (String)
Email subject. If not passed, the subject will be derived from the html template or text template, if available. Falls back to 'Mail from #site URL#'.
message (String)
Email content. This string will be merged into any {message} placeholders of the html/text template. If no html or text template exists, the string will be used as the email's simple text message.
template (String)
Name of template to be used.
from_name (String)
Name of sender. Falls back to #site name#.
from_email (String)
Email of sender. Falls back to, first, #site email#, and, then, #admin email#.
from_current_user (Boolean)
Will use current user's name and email as Sender information. If from_name and/or from_email is also send, they will take precedence.
reply_to (String)
Custom reply-to email.
values (Array)
Values that will be merged into the mail template.
recipients (Array|String)
Array or comma-separated string of recipient email adresses.
Bcc_recipients (Array|String)
Array or comma-separated string of CC email adresses.
bcc_recipients (Array|String)
Array or comma-separated string of BCC email adresses.
attachments (String|Array)
Path to attachment file, or array of paths to multiple attachments.
html (String)
Specify a HTML template directly. If the template option is also passed, it will take precedence.
text (String)
Specify a text template directly. If the template option is also passed, it will take precedence.
tracking (Boolean)
Switch tracking on/off, if supported by mail service (currently only Mailgun).
track_clicks (Boolean)
Switch clicks tracking on/off, if supported by mail service (currently only Mailgun).
track_opened (Boolean)
Switch opens tracking on/off, if supported by mail service (currently only Mailgun).

Return values

Object|False Object with id and message. False on error.

Examples

Dependencies

Janitor
  • Mailer::init_adapter
  • Mailer::getRecipients
  • Mailer::getTemplate
  • Mailer::getSender
  • DOM::createDom
  • DOM::getFormattedTextFromDOM

Mailer::sendBulk

Definition

Name
Mailer::sendBulk
Shorthand
mailer()->sendBulk()
Syntax
Object|false = Mailer::sendBulk( [Array|false $_options ] );

Description

Sends an email to several recipients, with custom values for each.

Parameters

$_options
Array|False
Options
subject (String)
Email subject. If not passed, the subject will be derived from the html template or text template, if available. Falls back to 'Mail from #site URL#'.
message (String)
Email content. This string will be merged into any {message} placeholders of the html/text template. If no html or text template exists, the string will be used as the email's simple text message.
template (String)
Name of template to be used.
from_name (String)
Name of sender. Falls back to #site name#.
from_email (String)
Email of sender. Falls back to, first, #site email#, and, then, #admin email#.
from_current_user (Boolean)
Will use current user's name and email as Sender information. If from_name and/or from_email is also send, they will take precedence.
reply_to (String)
Custom reply-to email.
values (Array)
Values that will be merged into the mail template. Each set of values is a subarray with the recipient email as key.
recipients (Array|String)
Array or comma-separated string of recipient email adresses.
cc_recipients (Array|String)
Array or comma-separated string of CC email adresses. The CC reicpient(s) will receive a copy of each email that was send to a recipient. Note: Currently disabled for Mailgun.
bcc_recipients (Array|String)
Array or comma-separated string of BCC email adresses. The BCC reicpient(s) will receive a copy of each email that was send to a recipient. Note: Currently disabled for Mailgun.
attachments (String|Array)
Path to attachment file, or array of paths to multiple attachments.
html (String)
Specify a HTML template directly. If the template option is also passed, it will take precedence.
text (String)
Specify a text template directly. If the template option is also passed, it will take precedence.
tracking (Boolean)
Switch tracking on/off, if supported by mail service (currently only Mailgun).
track_clicks (Boolean)
Switch clicks tracking on/off, if supported by mail service (currently only Mailgun).
track_opened (Boolean)
Switch opens tracking on/off, if supported by mail service (currently only Mailgun).

Return values

Object|False Object with id and message. False on error.

Examples

Dependencies

Janitor
  • Mailer::init_adapter
  • Mailer::getRecipients
  • Mailer::getTemplate
  • Mailer::getSender
  • DOM::createDom
  • DOM::getFormattedTextFromDOM