[ Index ] |
PHP Cross Reference of WordPress |
[Source view] [Print] [Project Stats]
PHPMailer - PHP email creation and transport class. PHP Version 5.5.
Author: | Marcus Bointon (Synchro/coolbru) <phpmailer@synchromedia.co.uk> |
Author: | Jim Jagielski (jimjag) <jimjag@gmail.com> |
Author: | Andy Prevost (codeworxtech) <codeworxtech@users.sourceforge.net> |
Author: | Brent R. Matzelle (original founder) |
Copyright: | 2012 - 2020 Marcus Bointon |
Copyright: | 2010 - 2012 Jim Jagielski |
Copyright: | 2004 - 2009 Andy Prevost |
License: | http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
File Size: | 5073 lines (178 kb) |
Included or required: | 2 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
PHPMailer:: (114 methods):
__construct()
__destruct()
mailPassthru()
edebug()
isHTML()
isSMTP()
isMail()
isSendmail()
isQmail()
addAddress()
addCC()
addBCC()
addReplyTo()
addOrEnqueueAnAddress()
addAnAddress()
parseAddresses()
setFrom()
getLastMessageID()
validateAddress()
idnSupported()
punyencodeAddress()
send()
preSend()
postSend()
sendmailSend()
isShellSafe()
isPermittedPath()
fileIsAccessible()
mailSend()
getSMTPInstance()
setSMTPInstance()
smtpSend()
smtpConnect()
smtpClose()
setLanguage()
getTranslations()
addrAppend()
addrFormat()
wrapText()
utf8CharBoundary()
setWordWrap()
createHeader()
getMailMIME()
getSentMIMEMessage()
generateId()
createBody()
getBoundary()
endBoundary()
setMessageType()
headerLine()
textLine()
addAttachment()
getAttachments()
attachAll()
encodeFile()
encodeString()
encodeHeader()
hasMultiBytes()
has8bitChars()
base64EncodeWrapMB()
encodeQP()
encodeQ()
addStringAttachment()
addEmbeddedImage()
addStringEmbeddedImage()
validateEncoding()
cidExists()
inlineImageExists()
attachmentExists()
alternativeExists()
clearQueuedAddresses()
clearAddresses()
clearCCs()
clearBCCs()
clearReplyTos()
clearAllRecipients()
clearAttachments()
clearCustomHeaders()
setError()
rfcDate()
serverHostname()
isValidHost()
lang()
getSmtpErrorMessage()
isError()
addCustomHeader()
getCustomHeaders()
msgHTML()
html2text()
_mime_types()
filenameToType()
mb_pathinfo()
set()
secureHeader()
normalizeBreaks()
stripTrailingWSP()
getLE()
setLE()
sign()
DKIM_QP()
DKIM_Sign()
DKIM_HeaderC()
DKIM_BodyC()
DKIM_Add()
hasLineLongerThanMax()
quotedString()
getToAddresses()
getCcAddresses()
getBccAddresses()
getReplyToAddresses()
getAllRecipientAddresses()
doCallback()
getOAuth()
setOAuth()
__construct($exceptions = null) X-Ref |
Constructor. param: bool $exceptions Should we throw external exceptions? |
__destruct() X-Ref |
Destructor. |
mailPassthru($to, $subject, $body, $header, $params) X-Ref |
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). return: bool param: string $to To param: string $subject Subject param: string $body Message Body param: string $header Additional Header(s) param: string|null $params Params |
edebug($str) X-Ref |
Output debugging info via a user-defined method. Only generates output if debug output is enabled. param: string $str |
isHTML($isHtml = true) X-Ref |
Sets message type to HTML or plain. param: bool $isHtml True for HTML mode |
isSMTP() X-Ref |
Send messages using SMTP. |
isMail() X-Ref |
Send messages using PHP's mail() function. |
isSendmail() X-Ref |
Send messages using $Sendmail. |
isQmail() X-Ref |
Send messages using qmail. |
addAddress($address, $name = '') X-Ref |
Add a "To" address. return: bool true on success, false if address already used or invalid in some way param: string $address The email address to send to param: string $name |
addCC($address, $name = '') X-Ref |
Add a "CC" address. return: bool true on success, false if address already used or invalid in some way param: string $address The email address to send to param: string $name |
addBCC($address, $name = '') X-Ref |
Add a "BCC" address. return: bool true on success, false if address already used or invalid in some way param: string $address The email address to send to param: string $name |
addReplyTo($address, $name = '') X-Ref |
Add a "Reply-To" address. return: bool true on success, false if address already used or invalid in some way param: string $address The email address to reply to param: string $name |
addOrEnqueueAnAddress($kind, $address, $name) X-Ref |
Add an address to one of the recipient arrays or to the ReplyTo array. Because PHPMailer can't validate addresses with an IDN without knowing the PHPMailer::$CharSet (that can still be modified after calling this function), addition of such addresses is delayed until send(). Addresses that have been added already return false, but do not throw exceptions. return: bool true on success, false if address already used or invalid in some way param: string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' param: string $address The email address to send, resp. to reply to param: string $name |
addAnAddress($kind, $address, $name = '') X-Ref |
Add an address to one of the recipient arrays or to the ReplyTo array. Addresses that have been added already return false, but do not throw exceptions. return: bool true on success, false if address already used or invalid in some way param: string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' param: string $address The email address to send, resp. to reply to param: string $name |
parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591) X-Ref |
Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name <address>" into an array of name/address pairs. Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. Note that quotes in the name part are removed. return: array param: string $addrstr The address list string param: bool $useimap Whether to use the IMAP extension to parse the list param: string $charset The charset to use when decoding the address list string. |
setFrom($address, $name = '', $auto = true) X-Ref |
Set the From and FromName properties. return: bool param: string $address param: string $name param: bool $auto Whether to also set the Sender address, defaults to true |
getLastMessageID() X-Ref |
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. return: string |
validateAddress($address, $patternselect = null) X-Ref |
Check that a string looks like an email address. Validation patterns supported: * `auto` Pick best pattern automatically; * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0; * `pcre` Use old PCRE implementation; * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. * `noregex` Don't use a regex: super fast, really dumb. Alternatively you may pass in a callable to inject your own validator, for example: ```php PHPMailer::validateAddress('user@example.com', function($address) { return (strpos($address, '@') !== false); }); ``` You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator. return: bool param: string $address The email address to check param: string|callable $patternselect Which pattern to use |
idnSupported() X-Ref |
Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the `intl` and `mbstring` PHP extensions. return: bool `true` if required functions for IDN support are present |
punyencodeAddress($address) X-Ref |
Converts IDN in given email address to its ASCII form, also known as punycode, if possible. Important: Address must be passed in same encoding as currently set in PHPMailer::$CharSet. This function silently returns unmodified address if: - No conversion is necessary (i.e. domain name is not an IDN, or is already in ASCII form) - Conversion to punycode is impossible (e.g. required PHP functions are not available) or fails for any reason (e.g. domain contains characters not allowed in an IDN). return: string The encoded address in ASCII form param: string $address The email address to convert |
send() X-Ref |
Create a message and send it. Uses the sending method specified by $Mailer. return: bool false on error - See the ErrorInfo property for details of the error |
preSend() X-Ref |
Prepare a message for sending. return: bool |
postSend() X-Ref |
Actually send a message via the selected mechanism. return: bool |
sendmailSend($header, $body) X-Ref |
Send mail using the $Sendmail program. return: bool param: string $header The message headers param: string $body The message body |
isShellSafe($string) X-Ref |
Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters. Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows. return: bool param: string $string The string to be validated |
isPermittedPath($path) X-Ref |
Check whether a file path is of a permitted type. Used to reject URLs and phar files from functions that access local file paths, such as addAttachment. return: bool param: string $path A relative or absolute path to a file |
fileIsAccessible($path) X-Ref |
Check whether a file path is safe, accessible, and readable. return: bool param: string $path A relative or absolute path to a file |
mailSend($header, $body) X-Ref |
Send mail using the PHP mail() function. return: bool param: string $header The message headers param: string $body The message body |
getSMTPInstance() X-Ref |
Get an instance to use for SMTP operations. Override this function to load your own SMTP implementation, or set one with setSMTPInstance. return: SMTP |
setSMTPInstance(SMTP $smtp) X-Ref |
Provide an instance to use for SMTP operations. return: SMTP |
smtpSend($header, $body) X-Ref |
Send mail via SMTP. Returns false if there is a bad MAIL FROM, RCPT, or DATA input. return: bool param: string $header The message headers param: string $body The message body |
smtpConnect($options = null) X-Ref |
Initiate a connection to an SMTP server. Returns false if the operation failed. return: bool param: array $options An array of options compatible with stream_context_create() |
smtpClose() X-Ref |
Close the active SMTP session if one exists. |
setLanguage($langcode = 'en', $lang_path = '') X-Ref |
Set the language for error messages. The default language is English. return: bool Returns true if the requested language was loaded, false otherwise. param: string $langcode ISO 639-1 2-character language code (e.g. French is "fr") param: string $lang_path Path to the language file directory, with trailing separator (slash) |
getTranslations() X-Ref |
Get the array of strings for the current language. return: array |
addrAppend($type, $addr) X-Ref |
Create recipient headers. return: string param: string $type param: array $addr An array of recipients, |
addrFormat($addr) X-Ref |
Format an address for use in a message header. return: string param: array $addr A 2-element indexed array, element 0 containing an address, element 1 containing a name like |
wrapText($message, $length, $qp_mode = false) X-Ref |
Word-wrap message. For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe. return: string param: string $message The message to wrap param: int $length The line length to wrap to param: bool $qp_mode Whether to run in Quoted-Printable mode |
utf8CharBoundary($encodedText, $maxLength) X-Ref |
Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string. Original written by Colin Brown. return: int param: string $encodedText utf-8 QP text param: int $maxLength Find the last character boundary prior to this length |
setWordWrap() X-Ref |
Apply word wrapping to the message body. Wraps the message body to the number of chars set in the WordWrap property. You should only do this to plain-text bodies as wrapping HTML tags may break them. This is called automatically by createBody(), so you don't need to call it yourself. |
createHeader() X-Ref |
Assemble message headers. return: string The assembled headers |
getMailMIME() X-Ref |
Get the message MIME type headers. return: string |
getSentMIMEMessage() X-Ref |
Returns the whole MIME message. Includes complete headers and body. Only valid post preSend(). return: string |
generateId() X-Ref |
Create a unique ID to use for boundaries. return: string |
createBody() X-Ref |
Assemble the message body. Returns an empty string on failure. return: string The assembled message body |
getBoundary($boundary, $charSet, $contentType, $encoding) X-Ref |
Return the start of a message boundary. return: string param: string $boundary param: string $charSet param: string $contentType param: string $encoding |
endBoundary($boundary) X-Ref |
Return the end of a message boundary. return: string param: string $boundary |
setMessageType() X-Ref |
Set the message type. PHPMailer only supports some preset message types, not arbitrary MIME structures. |
headerLine($name, $value) X-Ref |
Format a header line. return: string param: string $name param: string|int $value |
textLine($value) X-Ref |
Return a formatted mail line. return: string param: string $value |
addAttachment($path,$name = '',$encoding = self::ENCODING_BASE64,$type = '',$disposition = 'attachment') X-Ref |
Add an attachment from a path on the filesystem. Never use a user-supplied path to a file! Returns false if the file could not be found or read. Explicitly *does not* support passing URLs; PHPMailer is not an HTTP client. If you need to do that, fetch the resource yourself and pass it in via a local file or string. return: bool param: string $path Path to the attachment param: string $name Overrides the attachment name param: string $encoding File encoding (see $Encoding) param: string $type MIME type, e.g. `image/jpeg`; determined automatically from $path if not specified param: string $disposition Disposition to use |
getAttachments() X-Ref |
Return the array of attachments. return: array |
attachAll($disposition_type, $boundary) X-Ref |
Attach all file, string, and binary attachments to the message. Returns an empty string on failure. return: string param: string $disposition_type param: string $boundary |
encodeFile($path, $encoding = self::ENCODING_BASE64) X-Ref |
Encode a file attachment in requested format. Returns an empty string on failure. return: string param: string $path The full path to the file param: string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
encodeString($str, $encoding = self::ENCODING_BASE64) X-Ref |
Encode a string in requested format. Returns an empty string on failure. return: string param: string $str The text to encode param: string $encoding The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable' |
encodeHeader($str, $position = 'text') X-Ref |
Encode a header value (not including its label) optimally. Picks shortest of Q, B, or none. Result includes folding if needed. See RFC822 definitions for phrase, comment and text positions. return: string param: string $str The header value to encode param: string $position What context the string will be used in |
hasMultiBytes($str) X-Ref |
Check if a string contains multi-byte characters. return: bool param: string $str multi-byte text to wrap encode |
has8bitChars($text) X-Ref |
Does a string contain any 8-bit chars (in any charset)? return: bool param: string $text |
base64EncodeWrapMB($str, $linebreak = null) X-Ref |
Encode and wrap long multibyte strings for mail headers without breaking lines within a character. Adapted from a function by paravoid. return: string param: string $str multi-byte text to wrap encode param: string $linebreak string to use as linefeed/end-of-line |
encodeQP($string) X-Ref |
Encode a string in quoted-printable format. According to RFC2045 section 6.7. return: string param: string $string The text to encode |
encodeQ($str, $position = 'text') X-Ref |
Encode a string using Q encoding. return: string param: string $str the text to encode param: string $position Where the text is going to be used, see the RFC for what that means |
addStringAttachment($string,$filename,$encoding = self::ENCODING_BASE64,$type = '',$disposition = 'attachment') X-Ref |
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. return: bool True on successfully adding an attachment param: string $string String attachment data param: string $filename Name of the attachment param: string $encoding File encoding (see $Encoding) param: string $type File extension (MIME) type param: string $disposition Disposition to use |
addEmbeddedImage($path,$cid,$name = '',$encoding = self::ENCODING_BASE64,$type = '',$disposition = 'inline') X-Ref |
Add an embedded (inline) attachment from a file. This can include images, sounds, and just about any other document type. These differ from 'regular' attachments 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. Never use a user-supplied path to a file! return: bool True on successfully adding an attachment param: string $path Path to the attachment param: string $cid Content ID of the attachment; Use this to reference param: string $name Overrides the attachment name param: string $encoding File encoding (see $Encoding) param: string $type File MIME type param: string $disposition Disposition to use |
addStringEmbeddedImage($string,$cid,$name = '',$encoding = self::ENCODING_BASE64,$type = '',$disposition = 'inline') X-Ref |
Add an embedded stringified attachment. This can include images, sounds, and just about any other document type. If your filename doesn't contain an extension, be sure to set the $type to an appropriate MIME type. return: bool True on successfully adding an attachment param: string $string The attachment binary data param: string $cid Content ID of the attachment; Use this to reference param: string $name A filename for the attachment. If this contains an extension, param: string $encoding File encoding (see $Encoding), defaults to 'base64' param: string $type MIME type - will be used in preference to any automatically derived type param: string $disposition Disposition to use |
validateEncoding($encoding) X-Ref |
Validate encodings. return: bool param: string $encoding |
cidExists($cid) X-Ref |
Check if an embedded attachment is present with this cid. return: bool param: string $cid |
inlineImageExists() X-Ref |
Check if an inline attachment is present. return: bool |
attachmentExists() X-Ref |
Check if an attachment (non-inline) is present. return: bool |
alternativeExists() X-Ref |
Check if this message has an alternative body set. return: bool |
clearQueuedAddresses($kind) X-Ref |
Clear queued addresses of given kind. param: string $kind 'to', 'cc', or 'bcc' |
clearAddresses() X-Ref |
No description |
clearCCs() X-Ref |
Clear all CC recipients. |
clearBCCs() X-Ref |
Clear all BCC recipients. |
clearReplyTos() X-Ref |
Clear all ReplyTo recipients. |
clearAllRecipients() X-Ref |
Clear all recipient types. |
clearAttachments() X-Ref |
Clear all filesystem, string, and binary attachments. |
clearCustomHeaders() X-Ref |
Clear all custom headers. |
setError($msg) X-Ref |
Add an error message to the error container. param: string $msg |
rfcDate() X-Ref |
Return an RFC 822 formatted date. return: string |
serverHostname() X-Ref |
Get the server hostname. Returns 'localhost.localdomain' if unknown. return: string |
isValidHost($host) X-Ref |
Validate whether a string contains a valid value to use as a hostname or IP address. IPv6 addresses must include [], e.g. `[::1]`, not just `::1`. return: bool param: string $host The host name or IP address to check |
lang($key) X-Ref |
Get an error message in the current language. return: string param: string $key |
getSmtpErrorMessage($base_key) X-Ref |
Build an error message starting with a generic one and adding details if possible. return: string param: string $base_key |
isError() X-Ref |
Check if an error occurred. return: bool True if an error did occur |
addCustomHeader($name, $value = null) X-Ref |
Add a custom header. $name value can be overloaded to contain both header name and value (name:value). param: string $name Custom header name param: string|null $value Header value |
getCustomHeaders() X-Ref |
Returns all custom headers. return: array |
msgHTML($message, $basedir = '', $advanced = false) X-Ref |
Create a message body from an HTML string. Automatically inlines images and creates a plain-text version by converting the HTML, overwriting any existing values in Body and AltBody. Do not source $message content from user input! $basedir is prepended when handling relative URLs, e.g. <img src="/images/a.png"> and must not be empty will look for an image file in $basedir/images/a.png and convert it to inline. If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email) Converts data-uri images into embedded attachments. If you don't want to apply these transformations to your HTML, just set Body and AltBody directly. return: string The transformed message body param: string $message HTML message string param: string $basedir Absolute path to a base directory to prepend to relative paths to images param: bool|callable $advanced Whether to use the internal HTML to text converter |
html2text($html, $advanced = false) X-Ref |
Convert an HTML string into plain text. This is used by msgHTML(). Note - older versions of this function used a bundled advanced converter which was removed for license reasons in #232. Example usage: ```php //Use default conversion $plain = $mail->html2text($html); //Use your own custom converter $plain = $mail->html2text($html, function($html) { $converter = new MyHtml2text($html); return $converter->get_text(); }); ``` return: string param: string $html The HTML text to convert param: bool|callable $advanced Any boolean value to use the internal converter, |
_mime_types($ext = '') X-Ref |
Get the MIME type for a file extension. return: string MIME type of file param: string $ext File extension |
filenameToType($filename) X-Ref |
Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data. return: string param: string $filename A file name or full path, does not need to exist as a file |
mb_pathinfo($path, $options = null) X-Ref |
Multi-byte-safe pathinfo replacement. Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe. return: string|array param: string $path A filename or path, does not need to exist as a file param: int|string $options Either a PATHINFO_* constant, |
set($name, $value = '') X-Ref |
Set or reset instance properties. You should avoid this function - it's more verbose, less efficient, more error-prone and harder to debug than setting properties directly. Usage Example: `$mail->set('SMTPSecure', static::ENCRYPTION_STARTTLS);` is the same as: `$mail->SMTPSecure = static::ENCRYPTION_STARTTLS;`. return: bool param: string $name The property name to set param: mixed $value The value to set the property to |
secureHeader($str) X-Ref |
Strip newlines to prevent header injection. return: string param: string $str |
normalizeBreaks($text, $breaktype = null) X-Ref |
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. return: string param: string $text param: string $breaktype What kind of line break to use; defaults to static::$LE |
stripTrailingWSP($text) X-Ref |
Remove trailing breaks from a string. return: string The text to remove breaks from param: string $text |
getLE() X-Ref |
Return the current line break format string. return: string |
setLE($le) X-Ref |
Set the line break format string, e.g. "\r\n". param: string $le |
sign($cert_filename, $key_filename, $key_pass, $extracerts_filename = '') X-Ref |
Set the public and private key files and password for S/MIME signing. param: string $cert_filename param: string $key_filename param: string $key_pass Password for private key param: string $extracerts_filename Optional path to chain certificate |
DKIM_QP($txt) X-Ref |
Quoted-Printable-encode a DKIM header. return: string param: string $txt |
DKIM_Sign($signHeader) X-Ref |
Generate a DKIM signature. return: string The DKIM signature value param: string $signHeader |
DKIM_HeaderC($signHeader) X-Ref |
Generate a DKIM canonicalization header. Uses the 'relaxed' algorithm from RFC6376 section 3.4.2. Canonicalized headers should *always* use CRLF, regardless of mailer setting. return: string param: string $signHeader Header |
DKIM_BodyC($body) X-Ref |
Generate a DKIM canonicalization body. Uses the 'simple' algorithm from RFC6376 section 3.4.3. Canonicalized bodies should *always* use CRLF, regardless of mailer setting. return: string param: string $body Message Body |
DKIM_Add($headers_line, $subject, $body) X-Ref |
Create the DKIM header and body in a new message header. return: string param: string $headers_line Header lines param: string $subject Subject param: string $body Body |
hasLineLongerThanMax($str) X-Ref |
Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2.1.1. return: bool param: string $str |
quotedString($str) X-Ref |
If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash. return: string param: string $str |
getToAddresses() X-Ref |
Allows for public read access to 'to' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included. return: array |
getCcAddresses() X-Ref |
Allows for public read access to 'cc' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included. return: array |
getBccAddresses() X-Ref |
Allows for public read access to 'bcc' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included. return: array |
getReplyToAddresses() X-Ref |
Allows for public read access to 'ReplyTo' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included. return: array |
getAllRecipientAddresses() X-Ref |
Allows for public read access to 'all_recipients' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included. return: array |
doCallback($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra) X-Ref |
Perform a callback. param: bool $isSent param: array $to param: array $cc param: array $bcc param: string $subject param: string $body param: string $from param: array $extra |
getOAuth() X-Ref |
Get the OAuthTokenProvider instance. return: OAuthTokenProvider |
setOAuth(OAuthTokenProvider $oauth) X-Ref |
Set an OAuthTokenProvider instance. |
Generated: Tue Dec 24 01:00:02 2024 | Cross-referenced by PHPXref 0.7.1 |