vBulletin 5.6.5 API

vB_Mail_Smtp extends vB_Mail
in package

SMTP Mail Sending Object

This class sends email from vBulletin using an SMTP wrapper

Tags
version

$Revision: 99789 $

date

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

Table of Contents

$clientHost  : string
Client host
$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
$secure  : string
What security method to use
$shortcode_replace_map  : array<string|int, mixed>
Array of phrase shortcode replacements
$smtpHost  : string
SMTP host
$smtpPass  : string
SMTP password
$smtpPort  : int
SMTP port
$smtpReturn  : int
Return code from SMTP server
$smtpSocket  : resource
Raw SMTP socket
$smtpUser  : string
SMTP username
$subject  : string
Subject
$toemail  : string
Destination address
__construct()  : mixed
Constructor
__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
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
Attempts to send email based on parameters passed into start()/quick_set()
fetchFirstLine()  : string
Returns the first line of a string -- good to prevent errors when sending emails (above)
logEmail()  : mixed
Logs email to file
errorMessage()  : bool
Triggers PHP warning on error
sendHello()  : mixed
sendMessage()  : bool
Sends instruction to SMTP server

Properties

$clientHost

Client host

protected string $clientHost

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

$secure

What security method to use

protected string $secure = ''

$shortcode_replace_map

Array of phrase shortcode replacements

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

$smtpHost

SMTP host

protected string $smtpHost

$smtpPass

SMTP password

protected string $smtpPass

$smtpPort

SMTP port

protected int $smtpPort

$smtpReturn

Return code from SMTP server

protected int $smtpReturn = 0

$smtpSocket

Raw SMTP socket

protected resource $smtpSocket = ull

$smtpUser

SMTP username

protected string $smtpUser

$subject

Subject

protected string $subject = ''

$toemail

Destination address

protected string $toemail = ''

Methods

__construct()

Constructor

public __construct() : mixed
Return values
mixed

__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

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

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

protected execSend() : bool
Return values
bool

Returns false on error

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

errorMessage()

Triggers PHP warning on error

private errorMessage(string $msg) : bool
Parameters
$msg : string

Error message to be shown

Return values
bool

Always returns false (error)

sendHello()

private sendHello() : mixed
Return values
mixed

sendMessage()

Sends instruction to SMTP server

private sendMessage(string $msg[, mixed $expectedResult = false ]) : bool
Parameters
$msg : string

Message to be sent to server

$expectedResult : mixed = false

Message code expected to be returned or false if non expected

Return values
bool

Returns false on error

Search results