class vB_Mail

Mail class.

May use either the SMTP or Queue implementations to send the mail, depending on the options.

Traits

Properties

protected string $toemail Destination address
protected string $subject Subject
protected string $message Message
protected string $headers All headers to be sent with the message
protected string $fromemail Sender email
protected string $delimiter Line delimiter
protected boolean $debug Switch to enable/disable debugging. When enabled, warnings are not suppressed
protected string $log Message to log if logging is enabled
static protected boolean $enableTestCapture Used for unit tests. fetchLibrary() will return the test stub if this is set to true.
protected array $shortcode_replace_map Array of phrase shortcode replacements

Methods

__sleep()

No description

__wakeup()

No description

static bool
vbmail(string $toemail, string $subject, string $message, boolean $sendnow = false, string $from = '', string $uheaders = '', string $username = '', bool $skipFloodCheck = false, string $contentType = 'text/plain')

Starts the process of sending an email - either immediately or by adding it to the mail queue.

static 
vbmailStart()

Begin adding email to the mail queue

static 
vbmailEnd()

Stop adding mail to the mail queue and insert the mailqueue data for sending later

static 
execMailQueue()

Reads the email message queue and delivers a number of pending emails to the message sender

__construct()

Constructor

static vB_Mail
fetchLibrary(bool $deferred = false)

Factory method for mail.

bool
start(string $toemail, string $subject, string $message, string $from = '', string $uheaders = '', string $username = '', string $contentType = 'text/plain')

Starts the process of sending an email - preps it so it's fully ready to send.

quickSet(string $toemail, string $subject, string $message, string $headers, string $fromemail)

Set all the necessary variables for sending a message.

boolean
send(bool $force_send = false)

Send the mail.

boolean
execSend()

Actually send the message.

doShortcodeReplacements()

Does the phrase shortcode replacements for emails.

string
fetchFirstLine(string $text)

Returns the first line of a string -- good to prevent errors when sending emails (above)

string
encodeEmailHeader(string $text, string $charset = 'utf-8', bool $force_encode = false, bool $quoted_string = true)

Encodes a mail header to be RFC 2047 compliant. This allows for support of non-ASCII character sets via the quoted-printable encoding.

setDebug($debug)

Sets the debug member

logEmail(bool $status = true, bool $errfile = false)

Logs email to file

static 
emailFloodCheck()

No description

static 
setTestMode($enable = false)

No description

static 
getTestMode()

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 116
static bool vbmail(string $toemail, string $subject, string $message, boolean $sendnow = false, string $from = '', string $uheaders = '', string $username = '', bool $skipFloodCheck = false, string $contentType = 'text/plain')

Starts the process of sending an email - either immediately or by adding it to the mail queue.

Parameters

string $toemail Destination email address
string $subject Email message subject
string $message Email message body
boolean $sendnow If true, do not use the mail queue and send immediately
string $from Optional name/email to use in 'From' header
string $uheaders Additional headers
string $username Username of person sending the email
bool $skipFloodCheck If true, the flood check will be skipped
string $contentType Content type for email.

Return Value

bool

at line 152
static vbmailStart()

Begin adding email to the mail queue

at line 161
static vbmailEnd()

Stop adding mail to the mail queue and insert the mailqueue data for sending later

at line 170
static execMailQueue()

Reads the email message queue and delivers a number of pending emails to the message sender

at line 187
protected __construct()

Constructor

at line 208
static vB_Mail fetchLibrary(bool $deferred = false)

Factory method for mail.

Parameters

bool $deferred Whether mail sending can be deferred

Return Value

vB_Mail

at line 241
bool start(string $toemail, string $subject, string $message, string $from = '', string $uheaders = '', string $username = '', string $contentType = 'text/plain')

Starts the process of sending an email - preps it so it's fully ready to send.

Call send() to actually send it.

Parameters

string $toemail Destination email address
string $subject Email message subject
string $message Email message body
string $from Optional name/email to use in 'From' header
string $uheaders Additional headers
string $username Username of person sending the email
string $contentType Encoding for mail.

Return Value

bool True on success, false on failure

at line 378
quickSet(string $toemail, string $subject, string $message, string $headers, string $fromemail)

Set all the necessary variables for sending a message.

Parameters

string $toemail Destination address
string $subject Subject
string $message Message
string $headers All headers to be sent with the message
string $fromemail Sender email

at line 398
boolean send(bool $force_send = false)

Send the mail.

Note: If you define DISABLE_MAIL in config.php as: delimited email addresses - Only mail for the recipients will be sent .log - Mail will be logged to the given file if writable any other value - Mail will be disabled

Parameters

bool $force_send If true, DISABLE_MAIL will be ignored.

Return Value

boolean True on success, false on failure

at line 462
protected boolean execSend()

Actually send the message.

Return Value

boolean True on success, false on failure

at line 493
protected doShortcodeReplacements()

Does the phrase shortcode replacements for emails.

at line 547
protected string fetchFirstLine(string $text)

Returns the first line of a string -- good to prevent errors when sending emails (above)

Parameters

string $text String to be trimmed

Return Value

string

at line 570
protected string encodeEmailHeader(string $text, string $charset = 'utf-8', bool $force_encode = false, bool $quoted_string = true)

Encodes a mail header to be RFC 2047 compliant. This allows for support of non-ASCII character sets via the quoted-printable encoding.

Parameters

string $text The text to encode
string $charset The character set of the text
bool $force_encode Whether to force encoding into quoted-printable even if not necessary
bool $quoted_string Whether to quote the string; applies only if encoding is not done

Return Value

string The encoded header

at line 633
setDebug($debug)

Sets the debug member

Parameters

$debug boolean

at line 646
protected logEmail(bool $status = true, bool $errfile = false)

Logs email to file

Parameters

bool $status
bool $errfile

at line 707
static emailFloodCheck()

at line 732
static setTestMode($enable = false)

Parameters

$enable

at line 737
static getTestMode()