vBulletin 5.6.5 API

vB_Mail_Queue extends vB_Mail
in package

Mail queueing class. This class should be accessed as a singleton via fetchInstance()! This class does not actually send emails, but rather queues them to be sent later in a batch.

Tags
version

$Revision: 99789 $

date

$Date: 2010-05-29 02:50:59 +0800

Table of Contents

$bulk  : bool
Whether to do bulk inserts into the database.
$debug  : bool
Switch to enable/disable debugging. When enabled, warnings are not suppressed
$delimiter  : string
Line delimiter
$enableTestCapture  : bool
Used for unit tests. fetchLibrary() will return the test stub if this is set to true.
$fromemail  : string
Sender email
$headers  : string
All headers to be sent with the message
$log  : string
Message to log if logging is enabled
$mailcounter  : string
The number of mails being inserted into the queue
$mailsql  : array<string|int, mixed>
The data to insert into the mail queue
$message  : string
Message
$shortcode_replace_map  : array<string|int, mixed>
Array of phrase shortcode replacements
$subject  : string
Subject
$toemail  : string
Destination address
__serialize()  : mixed
__sleep()  : mixed
__unserialize()  : mixed
__wakeup()  : mixed
emailFloodCheck()  : mixed
execMailQueue()  : mixed
Reads the email message queue and delivers a number of pending emails to the message sender
execQueue()  : mixed
The only part of this class which actually sends an email.
fetchInstance()  : vB_QueueMail
Singleton emulator. Fetches the instance if it doesn't exist.
fetchLibrary()  : vB_Mail
Factory method for mail.
getTestMode()  : mixed
quickSet()  : mixed
Set all the necessary variables for sending a message.
send()  : bool
Send the mail.
setBulk()  : mixed
Sets the bulk option. If disabling the option, this also flushes the cache into the database.
setDebug()  : mixed
Sets the debug member
setTestMode()  : mixed
start()  : bool
Starts the process of sending an email - preps it so it's fully ready to send.
vbmail()  : bool
Starts the process of sending an email - either immediately or by adding it to the mail queue.
vbmailEnd()  : mixed
Stop adding mail to the mail queue and insert the mailqueue data for sending later
vbmailStart()  : mixed
Begin adding email to the mail queue
__construct()  : mixed
Constructor
arraySize()  : mixed
doShortcodeReplacements()  : mixed
Does the phrase shortcode replacements for emails.
encodeEmailHeader()  : string
Encodes a mail header to be RFC 2047 compliant. This allows for support of non-ASCII character sets via the quoted-printable encoding.
execSend()  : string
Inserts the message into the queue instead of sending it.
fetchFirstLine()  : string
Returns the first line of a string -- good to prevent errors when sending emails (above)
logEmail()  : mixed
Logs email to file

Properties

$bulk

Whether to do bulk inserts into the database.

protected bool $bulk = alse

Never set this option directly!

$debug

Switch to enable/disable debugging. When enabled, warnings are not suppressed

protected bool $debug = alse

$delimiter

Line delimiter

protected string $delimiter = " "

$enableTestCapture

Used for unit tests. fetchLibrary() will return the test stub if this is set to true.

protected static bool $enableTestCapture = alse

$fromemail

Sender email

protected string $fromemail = ''

$headers

All headers to be sent with the message

protected string $headers = ''

$log

Message to log if logging is enabled

protected string $log = ''

$mailcounter

The number of mails being inserted into the queue

protected string $mailcounter = 0

$mailsql

The data to insert into the mail queue

protected array<string|int, mixed> $mailsql = array()

$message

Message

protected string $message = ''

$shortcode_replace_map

Array of phrase shortcode replacements

protected array<string|int, mixed> $shortcode_replace_map = array()

$subject

Subject

protected string $subject = ''

$toemail

Destination address

protected string $toemail = ''

Methods

__serialize()

public __serialize() : mixed
Return values
mixed

__sleep()

public __sleep() : mixed
Return values
mixed

__unserialize()

public __unserialize(mixed $serialized) : mixed
Parameters
$serialized : mixed
Return values
mixed

__wakeup()

public __wakeup() : mixed
Return values
mixed

emailFloodCheck()

public static emailFloodCheck() : mixed
Return values
mixed

execMailQueue()

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

public static execMailQueue() : mixed
Return values
mixed

execQueue()

The only part of this class which actually sends an email.

public execQueue() : mixed

Sends mail from the queue.

Return values
mixed

fetchInstance()

Singleton emulator. Fetches the instance if it doesn't exist.

public static fetchInstance() : vB_QueueMail

Be sure to accept a reference if using this function!

Return values
vB_QueueMail

Reference to the instance

fetchLibrary()

Factory method for mail.

public static fetchLibrary([bool $deferred = false ]) : vB_Mail
Parameters
$deferred : bool = false

Whether mail sending can be deferred

Return values
vB_Mail

getTestMode()

public static getTestMode() : mixed
Return values
mixed

quickSet()

Set all the necessary variables for sending a message.

public quickSet(string $toemail, string $subject, string $message, string $headers, string $fromemail) : mixed
Parameters
$toemail : string

Destination address

$subject : string

Subject

$message : string

Message

$headers : string

All headers to be sent with the message

$fromemail : string

Sender email

Return values
mixed

send()

Send the mail.

public send([bool $force_send = false ]) : bool

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
$force_send : bool = false

If true, DISABLE_MAIL will be ignored.

Return values
bool

True on success, false on failure

setBulk()

Sets the bulk option. If disabling the option, this also flushes the cache into the database.

public setBulk(bool $bulk) : mixed
Parameters
$bulk : bool
Return values
mixed

setDebug()

Sets the debug member

public setDebug( $debug) : mixed
Parameters
$debug :

boolean

Return values
mixed

setTestMode()

public static setTestMode([mixed $enable = false ]) : mixed
Parameters
$enable : mixed = false
Return values
mixed

start()

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

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

Call send() to actually send it.

Parameters
$toemail : string

Destination email address

$subject : string

Email message subject

$message : string

Email message body

$from : string = ''

Optional name/email to use in 'From' header

$uheaders : string = ''

Additional headers

$username : string = ''

Username of person sending the email

$contentType : string = 'text/plain'

Encoding for mail.

Return values
bool

True on success, false on failure

vbmail()

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

public static vbmail(string $toemail, string $subject, string $message[, bool $sendnow = false ][, string $from = '' ][, string $uheaders = '' ][, string $username = '' ][, bool $skipFloodCheck = false ][, string $contentType = 'text/plain' ]) : bool
Parameters
$toemail : string

Destination email address

$subject : string

Email message subject

$message : string

Email message body

$sendnow : bool = false

If true, do not use the mail queue and send immediately

$from : string = ''

Optional name/email to use in 'From' header

$uheaders : string = ''

Additional headers

$username : string = ''

Username of person sending the email

$skipFloodCheck : bool = false

If true, the flood check will be skipped

$contentType : string = 'text/plain'

Content type for email.

Return values
bool

vbmailEnd()

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

public static vbmailEnd() : mixed
Return values
mixed

vbmailStart()

Begin adding email to the mail queue

public static vbmailStart() : mixed
Return values
mixed

__construct()

Constructor

protected __construct() : mixed
Return values
mixed

arraySize()

protected arraySize(mixed $a) : mixed
Parameters
$a : mixed
Return values
mixed

doShortcodeReplacements()

Does the phrase shortcode replacements for emails.

protected doShortcodeReplacements() : mixed
Return values
mixed

encodeEmailHeader()

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

protected encodeEmailHeader(string $text[, string $charset = 'utf-8' ][, bool $force_encode = false ][, bool $quoted_string = true ]) : string
Parameters
$text : string

The text to encode

$charset : string = 'utf-8'

The character set of the text

$force_encode : bool = false

Whether to force encoding into quoted-printable even if not necessary

$quoted_string : bool = true

Whether to quote the string; applies only if encoding is not done

Return values
string

The encoded header

execSend()

Inserts the message into the queue instead of sending it.

protected execSend() : string
Return values
string

True on success, false on failure

fetchFirstLine()

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

protected fetchFirstLine(string $text) : string
Parameters
$text : string

String to be trimmed

Return values
string

logEmail()

Logs email to file

protected logEmail([bool $status = true ][, bool $errfile = false ]) : mixed
Parameters
$status : bool = true
$errfile : bool = false
Return values
mixed

Search results