class vB_Mail_Smtp extends vB_Mail

SMTP Mail Sending Object

This class sends email from vBulletin using an SMTP wrapper

Traits

Properties

protected string $toemail Destination address from vB_Mail
protected string $subject Subject from vB_Mail
protected string $message Message from vB_Mail
protected string $headers All headers to be sent with the message from vB_Mail
protected string $fromemail Sender email from vB_Mail
protected string $delimiter Line delimiter from vB_Mail
protected boolean $debug Switch to enable/disable debugging. When enabled, warnings are not suppressed from vB_Mail
protected string $log Message to log if logging is enabled from vB_Mail
static protected boolean $enableTestCapture Used for unit tests. fetchLibrary() will return the test stub if this is set to true. from vB_Mail
protected array $shortcode_replace_map Array of phrase shortcode replacements from vB_Mail
protected string $clientHost Client host
protected string $smtpHost SMTP host
protected integer $smtpPort SMTP port
protected string $smtpUser SMTP username
protected string $smtpPass SMTP password
protected resource $smtpSocket Raw SMTP socket
protected integer $smtpReturn Return code from SMTP server
protected string $secure What security method to use

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.

from vB_Mail
static 
vbmailStart()

Begin adding email to the mail queue

from vB_Mail
static 
vbmailEnd()

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

from vB_Mail
static 
execMailQueue()

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

from vB_Mail
__construct()

Constructor

static vB_Mail
fetchLibrary(bool $deferred = false)

Factory method for mail.

from vB_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.

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

Set all the necessary variables for sending a message.

from vB_Mail
boolean
send(bool $force_send = false)

Send the mail.

from vB_Mail
boolean
execSend()

Attempts to send email based on parameters passed into start()/quick_set()

doShortcodeReplacements()

Does the phrase shortcode replacements for emails.

from vB_Mail
string
fetchFirstLine(string $text)

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

from vB_Mail
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.

from vB_Mail
setDebug($debug)

Sets the debug member

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

Logs email to file

from vB_Mail
static 
emailFloodCheck()

No description

from vB_Mail
static 
setTestMode($enable = false)

No description

from vB_Mail
static 
getTestMode()

No description

from vB_Mail

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

in vB_Mail 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

in vB_Mail at line 152
static vbmailStart()

Begin adding email to the mail queue

in vB_Mail at line 161
static vbmailEnd()

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

in vB_Mail at line 170
static execMailQueue()

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

at line 85
__construct()

Constructor

in vB_Mail 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

in 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

in vB_Mail 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

in vB_Mail 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 184
protected boolean execSend()

Attempts to send email based on parameters passed into start()/quick_set()

Return Value

boolean True on success, false on failure

in vB_Mail at line 493
protected doShortcodeReplacements()

Does the phrase shortcode replacements for emails.

in vB_Mail 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

in vB_Mail 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

in vB_Mail at line 633
setDebug($debug)

Sets the debug member

Parameters

$debug boolean

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

Logs email to file

Parameters

bool $status
bool $errfile

in vB_Mail at line 707
static emailFloodCheck()

in vB_Mail at line 732
static setTestMode($enable = false)

Parameters

$enable

in vB_Mail at line 737
static getTestMode()