STOP_MESSAGE
STOP_MESSAGE = 0
Error severity: message only, continue processing
PHPMailer - PHP email creation and transport class.
PHP Version 5.0.0
$ConfirmReadingTo :
The email address that a reading confirmation should be sent to.
type |
string |
---|
$Hostname :
The hostname to use in Message-Id and Received headers and as default HELO string.
If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.
type |
string |
---|
$MessageID :
An ID to be used in the Message-Id header.
If empty, a unique id will be generated.
type |
string |
---|
$MessageDate :
The message Date to be used in the Date header.
If empty, the current date will be added.
type |
string |
---|
$Host :
SMTP hosts.
Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com"). Hosts will be tried in order.
type |
string |
---|
type |
int |
---|---|
Todo |
Why is this needed when the SMTP class takes care of it? |
type |
string |
---|
type |
string |
---|
$SMTPAuth :
Whether to use SMTP authentication.
Uses the Username and Password properties.
type |
bool |
---|
type |
string |
---|
$SMTPDebug :
SMTP class debug output mode.
Options: 0 = off, 1 = commands, 2 = commands and data
type |
int |
---|
$Debugoutput :
The function/method to use for debugging output.
Options: "echo" or "error_log"
type |
string |
---|
$SMTPKeepAlive :
Whether to keep SMTP connection open after each message.
If this is set to true then to close the connection requires an explicit call to smtpClose().
type |
bool |
---|
$SingleTo :
Whether to split multiple to addresses into multiple messages or send them all in one message.
type |
bool |
---|
type |
array |
---|---|
todo |
This should really not be public |
$do_verp :
Whether to generate VERP addresses on send.
Only applicable when sending via SMTP.
type |
bool |
---|
note |
The default remains "\n". We force CRLF where we know it must be used via self::CRLF. |
---|---|
type |
string |
$DKIM_identity :
DKIM Identity.
Usually the email address used as the source of the email
type |
string |
---|
type |
string |
---|
$action_function :
Callback Action function name.
The function that handles the result of the send email action. It is called out by send() for each email sent.
Value can be any php callable: http://www.php.net/is_callable
Parameters: bool $result result of the send action string $to email address of the recipient string $cc cc email addresses string $bcc bcc email addresses string $subject the subject string $body the email body string $from email address of sender
type |
string |
---|
$XMailer :
What to use in the X-Mailer header.
Options: null for default, whitespace for none, or a string to use
type |
string |
---|
$all_recipients :
An array of all kinds of addresses.
Includes all of $to, $cc, $bcc, $replyto
type |
array |
---|
type |
string |
---|
$sign_key_pass :
The S/MIME password for the key.
Used only if the key is encrypted.
type |
string |
---|
__construct(boolean $exceptions = false)
Constructor
boolean | $exceptions | Should we throw external exceptions? |
None found |
None found |
isHTML(boolean $ishtml = true) : void
Sets message type to HTML or plain.
boolean | $ishtml | True for HTML mode. |
None found |
None found |
None found |
None found |
None found |
addAddress(string $address, string $name = '') : boolean
Add a "To" address.
string | $address | |
string | $name |
true on success, false if address already used
None found |
addCC(string $address, string $name = '') : boolean
Add a "CC" address.
string | $address | |
string | $name |
true on success, false if address already used
note |
: This function works with the SMTP mailer on win32, not with the "mail" mailer. |
---|
addBCC(string $address, string $name = '') : boolean
Add a "BCC" address.
string | $address | |
string | $name |
true on success, false if address already used
note |
: This function works with the SMTP mailer on win32, not with the "mail" mailer. |
---|
addReplyTo(string $address, string $name = '') : boolean
Add a "Reply-to" address.
string | $address | |
string | $name |
None found |
setFrom(string $address, string $name = '', boolean $auto = true) : boolean
Set the From and FromName properties.
string | $address | |
string | $name | |
boolean | $auto | Whether to also set the Sender address, defaults to true |
None found |
getLastMessageID() : string
Return the Message-ID header of the last email.
Technically this is the value from the last time the headers were created, but it's also the message ID of the last sent message except in pathological cases.
None found |
validateAddress(string $address, string $patternselect = 'auto') : boolean
Check that a string looks like an email address.
string | $address | The email address to check |
string | $patternselect | A selector for the validation pattern to use : 'auto' - pick best one automatically; 'pcre8' - use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; 'pcre' - use old PCRE implementation; 'php' - use PHP built-in FILTER_VALIDATE_EMAIL; faster, less thorough; 'noregex' - super fast, really dumb. |
static |
---|
send() : boolean
Create a message and send it.
Uses the sending method specified by $Mailer.
false on error - See the ErrorInfo property for details of the error.
None found |
preSend() : boolean
Prepare a message for sending.
None found |
postSend() : boolean
Actually send a message.
Send the email via the selected mechanism
None found |
getSMTPInstance() : \SMTP
Get an instance to use for SMTP operations.
Override this function to load your own SMTP implementation
None found |
smtpConnect(array $options = array()) : boolean
Initiate a connection to an SMTP server.
Returns false if the operation failed.
array | $options | An array of options compatible with stream_context_create() |
None found |
None found |
setLanguage(string $langcode = 'en', string $lang_path = 'language/') : boolean
Set the language for error messages.
Returns false if it cannot load the language file. The default language is English.
string | $langcode | ISO 639-1 2-character language code (e.g. French is "fr") |
string | $lang_path | Path to the language file directory, with trailing separator (slash) |
None found |
getTranslations() : array
Get the array of strings for the current language.
None found |
addrAppend(string $type, array $addr) : string
Create recipient headers.
string | $type | |
array | $addr | An array of recipient, where each recipient is a 2-element indexed array with element 0 containing an address and element 1 containing a name, like: array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User')) |
None found |
addrFormat(array $addr) : string
Format an address for use in a message header.
array | $addr | A 2-element indexed array, element 0 containing an address, element 1 containing a name like array('joe@example.com', 'Joe User') |
None found |
wrapText(string $message, integer $length, boolean $qp_mode = false) : string
Word-wrap message.
For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe.
string | $message | The message to wrap |
integer | $length | The line length to wrap to |
boolean | $qp_mode | Whether to run in Quoted-Printable mode |
None found |
utf8CharBoundary(string $encodedText, integer $maxLength) : integer
Find the last character boundary prior to $maxLength in a utf-8 quoted (printable) encoded string.
Original written by Colin Brown.
string | $encodedText | utf-8 QP text |
integer | $maxLength | find last character boundary prior to this length |
None found |
None found |
createHeader() : string
Assemble message headers.
The assembled headers
None found |
None found |
getSentMIMEMessage() : string
Returns the whole MIME message.
Includes complete headers and body. Only valid post PreSend().
None found |
createBody() : string
Assemble the message body.
Returns an empty string on failure.
The assembled message body
None found |
headerLine(string $name, string $value) : string
Format a header line.
string | $name | |
string | $value |
None found |
textLine(string $value) : string
Return a formatted mail line.
string | $value |
None found |
addAttachment(string $path, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'attachment') : boolean
Add an attachment from a path on the filesystem.
Returns false if the file could not be found or read.
string | $path | Path to the attachment. |
string | $name | Overrides the attachment name. |
string | $encoding | File encoding (see $Encoding). |
string | $type | File extension (MIME) type. |
string | $disposition | Disposition to use |
None found |
None found |
encodeString(string $str, string $encoding = 'base64') : string
Encode a string in requested format.
Returns an empty string on failure.
string | $str | The text to encode |
string | $encoding | The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
None found |
encodeHeader(string $str, string $position = 'text') : string
Encode a header string optimally.
Picks shortest of Q, B, quoted-printable or none.
string | $str | |
string | $position |
None found |
hasMultiBytes(string $str) : boolean
Check if a string contains multi-byte characters.
string | $str | multi-byte text to wrap encode |
None found |
has8bitChars(string $text) : boolean
Does a string contain any 8-bit chars (in any charset)?
string | $text |
None found |
base64EncodeWrapMB(string $str, string $lf = null) : string
Encode and wrap long multibyte strings for mail headers without breaking lines within a character.
Adapted from a function by paravoid
string | $str | multi-byte text to wrap encode |
string | $lf | string to use as linefeed/end-of-line |
None found |
encodeQP(string $string, integer $line_max = 76) : string
Encode a string in quoted-printable format.
According to RFC2045 section 6.7.
string | $string | The text to encode |
integer | $line_max | Number of chars allowed on a line before wrapping |
None found |
encodeQPphp(string $string, integer $line_max = 76, boolean $space_conv = false) : string
Backward compatibility wrapper for an old QP encoding function that was removed.
string | $string | |
integer | $line_max | |
boolean | $space_conv |
None found |
encodeQ(string $str, string $position = 'text') : string
Encode a string using Q encoding.
string | $str | the text to encode |
string | $position | Where the text is going to be used, see the RFC for what that means |
None found |
addStringAttachment(string $string, string $filename, string $encoding = 'base64', string $type = '', string $disposition = 'attachment') : void
Add a string or binary attachment (non-filesystem).
This method can be used to attach ascii or binary data, such as a BLOB record from a database.
string | $string | String attachment data. |
string | $filename | Name of the attachment. |
string | $encoding | File encoding (see $Encoding). |
string | $type | File extension (MIME) type. |
string | $disposition | Disposition to use |
None found |
addEmbeddedImage(string $path, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline') : boolean
Add an embedded (inline) attachment from a file.
This can include images, sounds, and just about any other document type. These differ from 'regular' attachmants in that they are intended to be displayed inline with the message, not just attached for download. This is used in HTML messages that embed the images the HTML refers to using the $cid value.
string | $path | Path to the attachment. |
string | $cid | Content ID of the attachment; Use this to reference the content when using an embedded image in HTML. |
string | $name | Overrides the attachment name. |
string | $encoding | File encoding (see $Encoding). |
string | $type | File MIME type. |
string | $disposition | Disposition to use |
True on successfully adding an attachment
None found |
addStringEmbeddedImage(string $string, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline') : boolean
Add an embedded stringified attachment.
This can include images, sounds, and just about any other document type. Be sure to set the $type to an image type for images: JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.
string | $string | The attachment binary data. |
string | $cid | Content ID of the attachment; Use this to reference the content when using an embedded image in HTML. |
string | $name | |
string | $encoding | File encoding (see $Encoding). |
string | $type | MIME type. |
string | $disposition | Disposition to use |
True on successfully adding an attachment
None found |
inlineImageExists() : boolean
Check if an inline attachment is present.
None found |
attachmentExists() : boolean
Check if an attachment (non-inline) is present.
None found |
alternativeExists() : boolean
Check if this message has an alternative body set.
None found |
None found |
None found |
None found |
None found |
None found |
None found |
None found |
static |
---|
isError() : boolean
Check if an error occurred.
True if an error did occur.
None found |
fixEOL(string $str) : string
Ensure consistent line endings in a string.
Changes every end of line from CRLF, CR or LF to $this->LE.
string | $str | String to fixEOL |
None found |
addCustomHeader(string $name, string $value = null) : void
Add a custom header.
$name value can be overloaded to contain both header name and value (name:value)
string | $name | Custom header name |
string | $value | Header value |
None found |
msgHTML(string $message, string $basedir = '', boolean $advanced = false) : string
Create a message from an HTML string.
Automatically makes modifications for inline images and backgrounds and creates a plain-text version by converting the HTML. Overwrites any existing values in $this->Body and $this->AltBody
string | $message | HTML message string |
string | $basedir | baseline directory for path |
boolean | $advanced | Whether to use the advanced HTML to text converter |
$message
None found |
html2text(string $html, boolean $advanced = false) : string
Convert an HTML string into plain text.
string | $html | The HTML text to convert |
boolean | $advanced | Should this use the more complex html2text converter or just a simple one? |
None found |
_mime_types(string $ext = '') : string
Get the MIME type for a file extension.
string | $ext | File extension |
MIME type of file.
static |
---|
filenameToType(string $filename) : string
Map a file name to a MIME type.
Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
string | $filename | A file name or full path, does not need to exist as a file |
static |
---|
mb_pathinfo(string $path, integer|string $options = null) : string|array
Multi-byte-safe pathinfo replacement.
Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. Works similarly to the one in PHP >= 5.2.0
string | $path | A filename or path, does not need to exist as a file |
integer|string | $options | Either a PATHINFO_* constant, or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2 |
static |
---|
set(string $name, mixed $value = '') : boolean
Set or reset instance properties.
Usage Example: $page->set('X-Priority', '3');
string | $name | |
mixed | $value | NOTE: will not work with arrays, there are no arrays to set/reset |
todo |
Should this not be using __set() magic function? |
---|
secureHeader(string $str) : string
Strip newlines to prevent header injection.
string | $str |
None found |
normalizeBreaks(string $text, string $breaktype = "\r\n") : string
Normalize line breaks in a string.
Converts UNIX LF, Mac CR and Windows CRLF line breaks into a single line break format. Defaults to CRLF (for message bodies) and preserves consecutive breaks.
string | $text | |
string | $breaktype | What kind of line break to use, defaults to CRLF |
static |
---|
sign(string $cert_filename, string $key_filename, string $key_pass)
Set the public and private key files and password for S/MIME signing.
string | $cert_filename | |
string | $key_filename | |
string | $key_pass | Password for private key |
None found |
DKIM_QP(string $txt) : string
Quoted-Printable-encode a DKIM header.
string | $txt |
None found |
DKIM_Sign(string $s) : string
Generate a DKIM signature.
string | $s | Header |
None found |
DKIM_HeaderC(string $s) : string
Generate a DKIM canonicalization header.
string | $s | Header |
None found |
DKIM_BodyC(string $body) : string
Generate a DKIM canonicalization body.
string | $body | Message Body |
None found |
DKIM_Add(string $headers_line, string $subject, string $body) : string
Create the DKIM header and body in a new message header.
string | $headers_line | Header lines |
string | $subject | Subject |
string | $body | Body |
None found |
getToAddresses() : array
Allows for public read access to 'to' property.
None found |
getCcAddresses() : array
Allows for public read access to 'cc' property.
None found |
getBccAddresses() : array
Allows for public read access to 'bcc' property.
None found |
getReplyToAddresses() : array
Allows for public read access to 'ReplyTo' property.
None found |
getAllRecipientAddresses() : array
Allows for public read access to 'all_recipients' property.
None found |
edebug(string $str)
Output debugging info via user-defined method.
Only if debug output is enabled.
string | $str |
None found |
addAnAddress(string $kind, string $address, string $name = '') : boolean
Add an address to one of the recipient arrays.
Addresses that have been added already return false, but do not throw exceptions
string | $kind | One of 'to', 'cc', 'bcc', 'ReplyTo' |
string | $address | The email address to send to |
string | $name |
true on success, false if address already used or invalid in some way
None found |
sendmailSend(string $header, string $body) : boolean
Send mail using the $Sendmail program.
string | $header | The message headers |
string | $body | The message body |
None found |
mailSend(string $header, string $body) : boolean
Send mail using the PHP mail() function.
string | $header | The message headers |
string | $body | The message body |
None found |
smtpSend(string $header, string $body) : boolean
Send mail via SMTP.
Returns false if there is a bad MAIL FROM, RCPT, or DATA input. Uses the PHPMailerSMTP class by default.
string | $header | The message headers |
string | $body | The message body |
None found |
getBoundary(string $boundary, string $charSet, string $contentType, string $encoding) : string
Return the start of a message boundary.
string | $boundary | |
string | $charSet | |
string | $contentType | |
string | $encoding |
None found |
endBoundary(string $boundary) : string
Return the end of a message boundary.
string | $boundary |
None found |
setMessageType() : void
Set the message type.
PHPMailer only supports some preset message types, not arbitrary MIME structures.
None found |
attachAll(string $disposition_type, string $boundary) : string
Attach all file, string, and binary attachments to the message.
Returns an empty string on failure.
string | $disposition_type | |
string | $boundary |
None found |
encodeFile(string $path, string $encoding = 'base64') : string
Encode a file attachment in requested format.
Returns an empty string on failure.
string | $path | The full path to the file |
string | $encoding | The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
None found |
setError(string $msg) : void
Add an error message to the error container.
string | $msg |
None found |
serverHostname() : string
Get the server hostname.
Returns 'localhost.localdomain' if unknown.
None found |
lang(string $key) : string
Get an error message in the current language.
string | $key |
None found |
doCallback(boolean $isSent, string $to, string $cc, string $bcc, string $subject, string $body, string $from = null)
Perform a callback.
boolean | $isSent | |
string | $to | |
string | $cc | |
string | $bcc | |
string | $subject | |
string | $body | |
string | $from |
None found |
mailPassthru(string $to, string $subject, string $body, string $header, string $params) : boolean
Call mail() in a safe_mode-aware fashion.
Also, unless sendmail_path points to sendmail (or something that claims to be sendmail), don't pass params (not a perfect fix, but it will do)
string | $to | To |
string | $subject | Subject |
string | $body | Message Body |
string | $header | Additional Header(s) |
string | $params | Params |
None found |