vBulletin 5.6.5 API

vB_Mail
in package
Uses vB_Trait_NoSerialize

Mail class.

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

Tags
version

$Revision: 102426 $

date

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

Table of Contents

$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
$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
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.
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
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()  : bool
Actually send the message.
fetchFirstLine()  : string
Returns the first line of a string -- good to prevent errors when sending emails (above)
logEmail()  : mixed
Logs email to file

Properties

$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 = ''

$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

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

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

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()

Actually send the message.

protected execSend() : bool
Return values
bool

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