PHPMailer - PHP email creation and transport class.
Constants |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer The SMTP standard CRLF line break. If you want to change line break format, change static::$LE, not this. |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer "Folding White Space" a white space string used for line folding. |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer |
public PHPMailer The maximum line length supported by mail(). Background: mail() will sometimes corrupt messages with headers longer than 65 chars, see #818.
|
public PHPMailer The maximum line length allowed by RFC 2822 section 2.1.1.
|
public PHPMailer The lower maximum line length allowed by RFC 2822 section 2.1.1. This length does NOT include the line break 76 means that lines will be 77 or 78 chars depending on whether the line break format is LF or CRLF; both are valid.
|
public PHPMailer Error severity: message, likely ok to continue processing.
|
public PHPMailer Error severity: message, plus full stop, critical error reached.
|
public PHPMailer Error severity: message only, continue processing.
|
public PHPMailer The PHPMailer Version number.
|
Properties |
public $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: https://www.php.net/is_callable Parameters: bool $result result of the send action array $to email addresses of the recipients array $cc cc email addresses array $bcc bcc email addresses string $subject the subject string $body the email body string $from email address of sender string $extra extra information of possible use "smtp_transaction_id' => last smtp transaction id
|
public $AllowEmpty = false Whether to allow sending messages with an empty body.
|
public $AltBody = '' The plain-text message body. This body can be read by mail clients that do not have HTML email capability such as mutt & Eudora. Clients that can read HTML will view the normal Body.
|
public $AuthType = '' SMTP authentication type. Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2. If not specified, the first one from that list that the server supports will be selected.
|
public $Body = '' An HTML or plain text message body. If HTML then call isHTML(true).
|
public $CharSet = 'iso-8859-1' The character set of the message.
|
public $ConfirmReadingTo = '' The email address that a reading confirmation should be sent to, also known as read receipt.
|
public $ContentType = 'text/plain' The MIME Content-type of the message.
|
public $Debugoutput = 'echo' How to handle debug output. Options:
Alternatively, you can pass in an instance of a PSR-3 compatible logger, though only
|
public $DKIM_copyHeaderFields = true DKIM Copy header field values for diagnostic use.
|
public $DKIM_domain = '' DKIM signing domain name.
|
public $DKIM_extraHeaders = [] DKIM Extra signing headers.
|
public $DKIM_identity = '' DKIM Identity. Usually the email address used as the source of the email.
|
public $DKIM_passphrase = '' DKIM passphrase. Used if your key is encrypted.
|
public $DKIM_private = '' DKIM private key file path.
|
public $DKIM_private_string = '' DKIM private key string. If set, takes precedence over
|
public $DKIM_selector = '' DKIM selector.
|
public $do_verp = false Whether to generate VERP addresses on send. Only applicable when sending via SMTP.
|
public $dsn = '' Comma separated list of DSN notifications 'NEVER' under no circumstances a DSN must be returned to the sender. If you use NEVER all other notifications will be ignored. 'SUCCESS' will notify you when your mail has arrived at its destination. 'FAILURE' will arrive if an error occurred during delivery. 'DELAY' will notify you if there is an unusual delay in delivery, but the actual delivery's outcome (success or failure) is not yet decided.
|
public $Encoding = '8bit' The message encoding. Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
|
public $ErrorInfo = '' Holds the most recent mailer error message.
|
public $From = '' The From email address for the message.
|
public $FromName = '' The From name of the message.
|
public $Helo = '' The SMTP HELO/EHLO name used for the SMTP connection. Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find one with the same method described above for $Hostname.
|
public $Host = 'localhost' 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"). You can also specify encryption type, for example: (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). Hosts will be tried in order.
|
public $Hostname = '' The hostname to use in the Message-ID header and as default HELO string. If empty, PHPMailer attempts to find one with, in order, $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value 'localhost.localdomain'.
|
public $Ical = '' An iCal message part body. Only supported in simple alt or alt_inline message types To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator.
|
public $Mailer = 'mail' Which method to use to send mail. Options: "mail", "sendmail", or "smtp".
|
public $MessageDate = '' The message Date to be used in the Date header. If empty, the current date will be added.
|
public $MessageID = '' An ID to be used in the Message-ID header. If empty, a unique id will be generated. You can set your own, but it must be in the format "id@domain", as defined in RFC5322 section 3.6.4 or it will be ignored.
|
public $Password = '' SMTP password.
|
public $Port = 25 The default SMTP server port.
|
public $Priority = NULL Email priority. Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
|
public $Sender = '' The envelope sender of the message. This will usually be turned into a Return-Path header by the receiver,
and is the address that bounces will be sent to.
If not empty, will be passed via
|
public $Sendmail = '/usr/sbin/sendmail' The path to the sendmail program.
|
public $SingleTo = false Whether to split multiple to addresses into multiple messages or send them all in one message. Only supported in
|
public $SMTPAuth = false Whether to use SMTP authentication. Uses the Username and Password properties.
|
public $SMTPAutoTLS = true Whether to enable TLS encryption automatically if a server supports it,
even if Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
|
public $SMTPDebug = 0 SMTP class debug output mode. Debug output level. Options:
|
public $SMTPKeepAlive = false Whether to keep the SMTP connection open after each message. If this is set to true then the connection will remain open after a send, and closing the connection will require an explicit call to smtpClose(). It's a good idea to use this if you are sending multiple messages as it reduces overhead. See the mailing list example for how to use it.
|
public $SMTPOptions = [] Options array passed to stream_context_create when connecting via SMTP.
|
public $SMTPSecure = '' What kind of encryption to use on the SMTP connection. Options: '', static::ENCRYPTION_STARTTLS, or static::ENCRYPTION_SMTPS.
|
public $Subject = '' The Subject of the message.
|
public $Timeout = 300 The SMTP server timeout in seconds. Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2.
|
public $Username = '' SMTP username.
|
public $UseSendmailOptions = true Whether mail() uses a fully sendmail-compatible MTA. One which supports sendmail's "-oi -f" options.
|
public static $validator = 'php' Which validator to use by default when validating email addresses. May be a callable to inject your own validator, but there are several built-in validators. The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option.
|
public $WordWrap = 0 Word-wrap the message body to this number of chars. Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
|
public $XMailer = '' What to put in the X-Mailer header. Options: An empty string for PHPMailer default, whitespace/null for none, or a string to use.
|
Methods |
public __construct( $exceptions = NULL) Constructor.
|
public __destruct() Destructor. |
public static _mime_types( $ext = '') Get the MIME type for a file extension.
|
public addAddress( $address, $name = '') Add a "To" address.
|
public addAttachment( $path, $name = '', $encoding = 'base64'self::ENCODING_BASE64, $type = '', $disposition = 'attachment') 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.
|
public addBCC( $address, $name = '') Add a "BCC" address.
|
public addCC( $address, $name = '') Add a "CC" address.
|
public addCustomHeader( $name, $value = NULL) Add a custom header. $name value can be overloaded to contain both header name and value (name:value).
|
public addEmbeddedImage( $path, $cid, $name = '', $encoding = 'base64'self::ENCODING_BASE64, $type = '', $disposition = 'inline') 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
|
public addrAppend( $type, $addr) Create recipient headers.
|
public addReplyTo( $address, $name = '') Add a "Reply-To" address.
|
public addrFormat( $addr) Format an address for use in a message header.
|
public addStringAttachment( $string, $filename, $encoding = 'base64'self::ENCODING_BASE64, $type = '', $disposition = 'attachment') 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.
|
public addStringEmbeddedImage( $string, $cid, $name = '', $encoding = 'base64'self::ENCODING_BASE64, $type = '', $disposition = 'inline') 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.
|
public alternativeExists() Check if this message has an alternative body set.
|
public attachmentExists() Check if an attachment (non-inline) is present.
|
public base64EncodeWrapMB( $str, $linebreak = NULL) Encode and wrap long multibyte strings for mail headers without breaking lines within a character. Adapted from a function by paravoid.
|
public clearAddresses() Clear all To recipients. |
public clearAllRecipients() Clear all recipient types. |
public clearAttachments() Clear all filesystem, string, and binary attachments. |
public clearBCCs() Clear all BCC recipients. |
public clearCCs() Clear all CC recipients. |
public clearCustomHeader( $name, $value = NULL) Clear a specific custom header by name or name and value. $name value can be overloaded to contain both header name and value (name:value).
|
public clearCustomHeaders() Clear all custom headers. |
public clearQueuedAddresses( $kind) Clear queued addresses of given kind.
|
public clearReplyTos() Clear all ReplyTo recipients. |
public createBody() Assemble the message body. Returns an empty string on failure.
|
public createHeader() Assemble message headers.
|
public DKIM_Add( $headers_line, $subject, $body) Create the DKIM header and body in a new message header.
|
public DKIM_BodyC( $body) 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.
|
public DKIM_HeaderC( $signHeader) 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.
|
public DKIM_QP( $txt) Quoted-Printable-encode a DKIM header.
|
public DKIM_Sign( $signHeader) Generate a DKIM signature.
|
public encodeHeader( $str, $position = 'text') 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.
|
public encodeQ( $str, $position = 'text') Encode a string using Q encoding.
|
public encodeQP( $string) Encode a string in quoted-printable format. According to RFC2045 section 6.7.
|
public encodeString( $str, $encoding = 'base64'self::ENCODING_BASE64) Encode a string in requested format. Returns an empty string on failure.
|
public static filenameToType( $filename) Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
|
public getAllRecipientAddresses() Allows for public read access to 'all_recipients' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
public getAttachments() Return the array of attachments.
|
public getBccAddresses() Allows for public read access to 'bcc' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
public getBoundaries() Get the boundaries that this message will use
|
public getCcAddresses() Allows for public read access to 'cc' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
public getCustomHeaders() Returns all custom headers.
|
public getLastMessageID() 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.
|
public static getLE() Return the current line break format string.
|
public getMailMIME() Get the message MIME type headers.
|
public getOAuth() Get the OAuthTokenProvider instance.
|
public getReplyToAddresses() Allows for public read access to 'ReplyTo' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
public getSentMIMEMessage() Returns the whole MIME message. Includes complete headers and body. Only valid post preSend().
|
public getSMTPInstance() Get an instance to use for SMTP operations. Override this function to load your own SMTP implementation, or set one with setSMTPInstance.
|
public getSMTPXclientAttributes() Get SMTP XCLIENT attributes
|
public getToAddresses() Allows for public read access to 'to' property. Before the send() call, queued addresses (i.e. with IDN) are not yet included.
|
public getTranslations() Get the array of strings for the current language.
|
public has8bitChars( $text) Does a string contain any 8-bit chars (in any charset)?
|
public static hasLineLongerThanMax( $str) Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2.1.1.
|
public hasMultiBytes( $str) Check if a string contains multi-byte characters.
|
public headerLine( $name, $value) Format a header line.
|
public html2text( $html, $advanced = false) 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:
|
public static idnSupported() Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the
|
public inlineImageExists() Check if an inline attachment is present.
|
public isError() Check if an error occurred.
|
public isHTML( $isHtml = true) Sets message type to HTML or plain.
|
public isMail() Send messages using PHP's mail() function. |
public isQmail() Send messages using qmail. |
public isSendmail() Send messages using $Sendmail. |
public isSMTP() Send messages using SMTP. |
public static isValidHost( $host) Validate whether a string contains a valid value to use as a hostname or IP address. IPv6 addresses must include [], e.g.
|
public static mb_pathinfo( $path, $options = NULL) Multi-byte-safe pathinfo replacement. Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.
|
public msgHTML( $message, $basedir = '', $advanced = false) 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. 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.
|
public static normalizeBreaks( $text, $breaktype = NULL) 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.
|
public static parseAddresses( $addrstr, $useimap = true, $charset = 'iso-8859-1'self::CHARSET_ISO88591) Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name " 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.
|
public postSend() Actually send a message via the selected mechanism.
|
public preSend() Prepare a message for sending.
|
public punyencodeAddress( $address) 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:
|
public static quotedString( $str) If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash.
|
public replaceCustomHeader( $name, $value = NULL) Replace a custom header. $name value can be overloaded to contain both header name and value (name:value).
|
public static rfcDate() Return an RFC 822 formatted date.
|
public secureHeader( $str) Strip newlines to prevent header injection.
|
public send() Create a message and send it. Uses the sending method specified by $Mailer.
|
public set( $name, $value = '') 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:
|
public setBoundaries() Set the boundaries to use for delimiting MIME parts. If you override this, ensure you set all 3 boundaries to unique values. The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies, as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7
|
public setFrom( $address, $name = '', $auto = true) Set the From and FromName properties.
|
public setLanguage( $langcode = 'en', $lang_path = '') Set the language for error messages. The default language is English.
|
public setOAuth(PHPMailer Set an OAuthTokenProvider instance. |
public setSMTPInstance(PHPMailer Provide an instance to use for SMTP operations.
|
public setSMTPXclientAttribute( $name, $value) Provide SMTP XCLIENT attributes
|
public setWordWrap() 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. |
public sign( $cert_filename, $key_filename, $key_pass, $extracerts_filename = '') Set the public and private key files and password for S/MIME signing.
|
public smtpClose() Close the active SMTP session if one exists. |
public smtpConnect( $options = NULL) Initiate a connection to an SMTP server. Returns false if the operation failed.
|
public static stripTrailingBreaks( $text) Strip trailing line breaks from a string.
|
public static stripTrailingWSP( $text) Remove trailing whitespace from a string.
|
public textLine( $value) Return a formatted mail line.
|
public utf8CharBoundary( $encodedText, $maxLength) Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string. Original written by Colin Brown.
|
public static validateAddress( $address, $patternselect = NULL) Check that a string looks like an email address. Validation patterns supported:
You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
|
public wrapText( $message, $length, $qp_mode = false) Word-wrap message. For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe.
|
Properties |
protected $all_recipients = [] An array of all kinds of addresses. Includes all of $to, $cc, $bcc.
|
protected $attachment = [] The array of attachments.
|
protected $bcc = [] The array of 'bcc' names and addresses.
|
protected $boundary = [] The array of MIME boundary strings.
|
protected $cc = [] The array of 'cc' names and addresses.
|
protected $CustomHeader = [] The array of custom headers.
|
protected $error_count = 0 The number of errors encountered.
|
protected $exceptions = false Whether to throw exceptions for errors.
|
protected static $IcalMethods = ['REQUEST', 'PUBLISH', 'REPLY', 'ADD', 'CANCEL', 'REFRESH', 'COUNTER', 'DECLINECOUNTER'] Value-array of "method" in Contenttype header "text/calendar"
|
protected $language = [] The array of available text strings for the current language.
|
protected $lastMessageID = '' The most recent Message-ID (including angular brackets).
|
protected static $LE = '
' SMTP RFC standard line ending; Carriage Return, Line Feed.
|
protected $mailHeader = '' Extra headers that createHeader() doesn't fold in.
|
protected $message_type = '' The message's MIME type.
|
protected $MIMEBody = '' The complete compiled MIME message body.
|
protected $MIMEHeader = '' The complete compiled MIME message headers.
|
protected $oauth = NULL An implementation of the PHPMailer OAuthTokenProvider interface.
|
protected $RecipientsQueue = [] An array of names and addresses queued for validation. In send(), valid and non duplicate entries are moved to $all_recipients and one of $to, $cc, or $bcc. This array is used only for addresses with IDN.
|
protected $ReplyTo = [] The array of reply-to names and addresses.
|
protected $ReplyToQueue = [] An array of reply-to names and addresses queued for validation. In send(), valid and non duplicate entries are moved to $ReplyTo. This array is used only for addresses with IDN.
|
protected $sign_cert_file = '' The S/MIME certificate file path.
|
protected $sign_extracerts_file = '' The optional S/MIME extra certificates ("CA Chain") file path.
|
protected $sign_key_file = '' The S/MIME key file path.
|
protected $sign_key_pass = '' The S/MIME password for the key. Used only if the key is encrypted.
|
protected $SingleToArray = [] Storage for addresses when SingleTo is enabled.
|
protected $smtp = NULL An instance of the SMTP sender class.
|
protected $SMTPXClient = [] SMTP SMTPXClient command attributes
|
protected $to = [] The array of 'to' names and addresses.
|
protected $uniqueid = '' Unique ID used for message ID and boundaries.
|
Methods |
protected addAnAddress( $kind, $address, $name = '') 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.
|
protected addOrEnqueueAnAddress( $kind, $address, $name) 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.
|
protected attachAll( $disposition_type, $boundary) Attach all file, string, and binary attachments to the message. Returns an empty string on failure.
|
protected cidExists( $cid) Check if an embedded attachment is present with this cid.
|
protected doCallback( $isSent, $to, $cc, $bcc, $subject, $body, $from, $extra) Perform a callback.
|
protected edebug( $str) Output debugging info via a user-defined method. Only generates output if debug output is enabled.
|
protected encodeFile( $path, $encoding = 'base64'self::ENCODING_BASE64) Encode a file attachment in requested format. Returns an empty string on failure.
|
protected endBoundary( $boundary) Return the end of a message boundary.
|
protected static fileIsAccessible( $path) Check whether a file path is safe, accessible, and readable.
|
protected generateId() Create a unique ID to use for boundaries.
|
protected getBoundary( $boundary, $charSet, $contentType, $encoding) Return the start of a message boundary.
|
protected static isPermittedPath( $path) 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.
|
protected static isShellSafe( $string) 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.
|
protected lang( $key) Get an error message in the current language.
|
protected mailSend( $header, $body) Send mail using the PHP mail() function.
|
protected sendmailSend( $header, $body) Send mail using the $Sendmail program.
|
protected serverHostname() Get the server hostname. Returns 'localhost.localdomain' if unknown.
|
protected setError( $msg) Add an error message to the error container.
|
protected static setLE( $le) Set the line break format string, e.g. "\r\n".
|
protected setMessageType() Set the message type. PHPMailer only supports some preset message types, not arbitrary MIME structures. |
protected smtpSend( $header, $body) Send mail via SMTP. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
|
protected validateEncoding( $encoding) Validate encodings.
|
Methods |
private getSmtpErrorMessage( $base_key) Build an error message starting with a generic one and adding details if possible.
|
private mailPassthru( $to, $subject, $body, $header, $params) 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).
|
Properties |
protected static $IcalMethods = ['REQUEST', 'PUBLISH', 'REPLY', 'ADD', 'CANCEL', 'REFRESH', 'COUNTER', 'DECLINECOUNTER'] Value-array of "method" in Contenttype header "text/calendar"
|
protected static $LE = '
' SMTP RFC standard line ending; Carriage Return, Line Feed.
|
public static $validator = 'php' Which validator to use by default when validating email addresses. May be a callable to inject your own validator, but there are several built-in validators. The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option.
|
Methods |
public static _mime_types( $ext = '') Get the MIME type for a file extension.
|
protected static fileIsAccessible( $path) Check whether a file path is safe, accessible, and readable.
|
public static filenameToType( $filename) Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
|
public static getLE() Return the current line break format string.
|
public static hasLineLongerThanMax( $str) Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2.1.1.
|
public static idnSupported() Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the
|
protected static isPermittedPath( $path) 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.
|
protected static isShellSafe( $string) 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.
|
public static isValidHost( $host) Validate whether a string contains a valid value to use as a hostname or IP address. IPv6 addresses must include [], e.g.
|
public static mb_pathinfo( $path, $options = NULL) Multi-byte-safe pathinfo replacement. Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.
|
public static normalizeBreaks( $text, $breaktype = NULL) 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.
|
public static parseAddresses( $addrstr, $useimap = true, $charset = 'iso-8859-1'self::CHARSET_ISO88591) Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name " 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.
|
public static quotedString( $str) If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash.
|
public static rfcDate() Return an RFC 822 formatted date.
|
protected static setLE( $le) Set the line break format string, e.g. "\r\n".
|
public static stripTrailingBreaks( $text) Strip trailing line breaks from a string.
|
public static stripTrailingWSP( $text) Remove trailing whitespace from a string.
|
public static validateAddress( $address, $patternselect = NULL) Check that a string looks like an email address. Validation patterns supported:
You can also set the PHPMailer::$validator static to a callable, allowing built-in methods to use your validator.
|