class CRM_Utils_Mail

Methods

static Mail
createMailer()

Create a new mailer to send any mail from the application.

static object
_createMailer(string $driver, array $params)

Create a new instance of a PEAR Mail driver.

static bool
send(array $params)

Wrapper function to send mail in CiviCRM. Hooks are called from this function. The input parameter is an associateive array which holds the values of field needed to send an email. These are:

static string
errorMessage($mailer, $result)

No description

static 
logger($to, $headers, $message)

No description

static string
pluckEmailFromHeader(string $header)

Get the email address itself from a formatted full name + address string

static bool
validOutBoundMail()

Get the Active outBound email.

static mixed
setMimeParams($message, array $params = NULL)

No description

static null|string
formatRFC822Email(string $name, $email, bool $useQuote = FALSE)

No description

static string
formatRFC2822Name(string $name)

Takes a string and checks to see if it needs to be escaped / double quoted and if so does the needful and return the formatted name

static array
appendPDF(string $fileName, string $html, string $format = NULL)

No description

Details

at line 45
static Mail createMailer()

Create a new mailer to send any mail from the application.

Note: The mailer is opened in persistent mode.

Note: You probably don't want to call this directly. Get a reference to the mailer through the container.

Return Value

Mail

at line 122
static object _createMailer(string $driver, array $params)

Create a new instance of a PEAR Mail driver.

Parameters

string $driver 'CRM_Mailing_BAO_Spool' or a name suitable for Mail::factory().
array $params

Return Value

object More specifically, a class which implements the "send()" function

at line 157
static bool send(array $params)

Wrapper function to send mail in CiviCRM. Hooks are called from this function. The input parameter is an associateive array which holds the values of field needed to send an email. These are:

from : complete from envelope toName : name of person to send email toEmail : email address to send to cc : email addresses to cc bcc : email addresses to bcc subject : subject of the email text : text of the message html : html version of the message replyTo : reply-to header in the email attachments: an associative array of fullPath : complete pathname to the file mime_type: mime type of the attachment cleanName: the user friendly name of the attachmment

Parameters

array $params (by reference).

Return Value

bool TRUE if a mail was sent, else FALSE.

at line 301
static string errorMessage($mailer, $result)

Parameters

$mailer
$result

Return Value

string

at line 325
static logger($to, $headers, $message)

Parameters

$to
$headers
$message

at line 365
static string pluckEmailFromHeader(string $header)

Get the email address itself from a formatted full name + address string

Ugly but working.

Parameters

string $header The full name + email address string.

Return Value

string the plucked email address

at line 380
static bool validOutBoundMail()

Get the Active outBound email.

Return Value

bool TRUE if valid outBound email configuration found, false otherwise.

at line 412
static mixed setMimeParams($message, array $params = NULL)

Parameters

$message
array $params

Return Value

mixed

at line 436
static null|string formatRFC822Email(string $name, $email, bool $useQuote = FALSE)

Parameters

string $name
$email
bool $useQuote

Return Value

null|string

at line 478
static string formatRFC2822Name(string $name)

Takes a string and checks to see if it needs to be escaped / double quoted and if so does the needful and return the formatted name

This code has been copied and adapted from ezc/Mail/src/tools.php

Parameters

string $name

Return Value

string

at line 502
static array appendPDF(string $fileName, string $html, string $format = NULL)

Parameters

string $fileName
string $html
string $format

Return Value

array