Class PHPMailer
PHPMailer - PHP email creation and transport class.
Direct known subclasses
Copyright: 2012 - 2014 Marcus Bointon
Copyright: 2010 - 2012 Jim Jagielski
Copyright: 2004 - 2009 Andy Prevost
License: GNU Lesser General Public License
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)
Located at vendor/phpmailer/phpmailer/class.phpmailer.php
Methods summary
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 protected 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 protected 
				boolean
				
				 | 
			#
			 addOrEnqueueAnAddress( string $kind, string $address, string $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 
				boolean
				
				 | 
			#
			 addAnAddress( string $kind, string $address, string $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. | 
| 
				 public 
				array
				
				 | 
			#
			 parseAddresses( string $addrstr, boolean $useimap = true )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. | 
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				string
				
				 | 
			#
			 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
				boolean
				
				 | 
			#
			 validateAddress( string $address, string|callable $patternselect = null )Check that a string looks like an email address. | 
| 
				 public 
				boolean
				
				 | 
			#
			 idnSupported( )Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the "intl" and "mbstring" PHP extensions. | 
| 
				 public 
				string
				
				 | 
			#
			 punyencodeAddress( string $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 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 protected 
				boolean
				
				 | |
| 
				 protected static
				boolean
				
				 | 
			#
			 isShellSafe( string $string )Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters. | 
| 
				 protected 
				boolean
				
				 | |
| 
				 public 
				 | 
			#
			 getSMTPInstance( )Get an instance to use for SMTP operations. Override this function to load your own SMTP implementation | 
| 
				 protected 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | 
			#
			 smtpConnect( array $options = null )Initiate a connection to an SMTP server. Returns false if the operation failed. | 
| 
				 public 
				
				
				 | |
| 
				 public 
				boolean
				
				 | 
			#
			 setLanguage( string $langcode = 'en', string $lang_path = '' )Set the language for error messages. Returns false if it cannot load the language file. The default language is English. | 
| 
				 public 
				array
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				integer
				
				 | 
			#
			 utf8CharBoundary( string $encodedText, integer $maxLength )Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string. Original written by Colin Brown. | 
| 
				 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 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | 
			#
			 getSentMIMEMessage( )Returns the whole MIME message. Includes complete headers and body. Only valid post preSend(). | 
| 
				 protected 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 protected 
				string
				
				 | 
			#
			 getBoundary( string $boundary, string $charSet, string $contentType, string $encoding )Return the start of a message boundary. | 
| 
				 protected 
				string
				
				 | |
| 
				 protected 
				
				
				 | 
			#
			 setMessageType( )Set the message type. PHPMailer only supports some preset message types, not arbitrary MIME structures. | 
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				boolean
				
				 | 
			#
			 addAttachment( string $path, string $name = '', string $encoding = 'base64', string $type = '', string $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. | 
| 
				 public 
				array
				
				 | |
| 
				 protected 
				string
				
				 | |
| 
				 protected 
				string
				
				 | 
			#
			 encodeFile( string $path, string $encoding = 'base64' )Encode a file attachment in requested format. Returns an empty string on failure. | 
| 
				 public 
				string
				
				 | 
			#
			 encodeString( string $str, string $encoding = 'base64' )Encode a string in requested format. Returns an empty string on failure. | 
| 
				 public 
				string
				
				 | 
			#
			 encodeHeader( string $str, string $position = 'text' )Encode a header string optimally. Picks shortest of Q, B, quoted-printable or none. | 
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				string
				
				 | 
			#
			 base64EncodeWrapMB( string $str, string $linebreak = null )Encode and wrap long multibyte strings for mail headers without breaking lines within a character. Adapted from a function by paravoid | 
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | 
			#
			 encodeQPphp( string $string, integer $line_max = 76, boolean $space_conv = false  )Backward compatibility wrapper for an old QP encoding function that was removed. | 
| 
				 public 
				string
				
				 | |
| 
				 public 
				
				
				 | 
			#
			 addStringAttachment( string $string, string $filename, string $encoding = 'base64', string $type = '', string $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 
				boolean
				
				 | 
			#
			 addEmbeddedImage( string $path, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $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 $cid value. Never use a user-supplied path to a file! | 
| 
				 public 
				boolean
				
				 | 
			#
			 addStringEmbeddedImage( string $string, string $cid, string $name = '', string $encoding = 'base64', string $type = '', string $disposition = 'inline'  )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'. | 
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 public 
				
				
				 | |
| 
				 protected 
				
				
				 | |
| 
				 public static
				string
				
				 | |
| 
				 protected 
				string
				
				 | |
| 
				 protected 
				string
				
				 | |
| 
				 public 
				boolean
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				
				
				 | 
			#
			 addCustomHeader( string $name, string $value = null )Add a custom header. $name value can be overloaded to contain both header name and value (name:value) | 
| 
				 public 
				array
				
				 | |
| 
				 public 
				string
				
				 | 
			#
			 msgHTML( string $message, string $basedir = '', boolean|callable $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. <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) If you don't want to apply these transformations to your HTML, just set Body and AltBody directly. | 
| 
				 public 
				string
				
				 | 
			#
			 html2text( string $html, boolean|callable $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 been removed for license reasons in #232. Example usage: // 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(); }); | 
| 
				 public static
				string
				
				 | |
| 
				 public static
				string
				
				 | 
			#
			 filenameToType( string $filename )Map a file name to a MIME type. Defaults to 'application/octet-stream', i.e.. arbitrary binary data. | 
| 
				 public static
				string|array
				
				 | 
			#
			 mb_pathinfo( string $path, integer|string $options = null )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 | 
| 
				 public 
				boolean
				
				 | 
			#
			 set( string $name, mixed $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 
				string
				
				 | |
| 
				 public static
				string
				
				 | 
			#
			 normalizeBreaks( string $text, string $breaktype = "\r\n" )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 
				
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public 
				string
				
				 | |
| 
				 public static
				boolean
				
				 | 
			#
			 hasLineLongerThanMax( string $str )Detect if a string contains a line longer than the maximum line length allowed. | 
| 
				 public 
				array
				
				 | |
| 
				 public 
				array
				
				 | |
| 
				 public 
				array
				
				 | |
| 
				 public 
				array
				
				 | |
| 
				 public 
				array
				
				 | |
| 
				 protected 
				
				
				 | 
			#
			 doCallback( boolean $isSent, array $to, array $cc, array $bcc, string $subject, string $body, string $from )Perform a callback. | 
Magic methods summary
Constants summary
| integer | 
					STOP_MESSAGE
			 | 0 | 
				#
				 Error severity: message only, continue processing. | 
| integer | 
					STOP_CONTINUE
			 | 1 | 
				#
				 Error severity: message, likely ok to continue processing. | 
| integer | 
					STOP_CRITICAL
			 | 2 | 
				#
				 Error severity: message, plus full stop, critical error reached. | 
| string | 
					CRLF
			 | "\r\n" | 
				#
				 SMTP RFC standard line ending. | 
| integer | 
					MAX_LINE_LENGTH
			 | 998 | 
				#
				 The maximum line length allowed by RFC 2822 section 2.1.1 | 
Properties summary
| 
				public  
				string
			 | $Version | 
				#
				 The PHPMailer Version number. | 
| 
				public  
				integer
			 | $Priority | 
				#
				 Email priority. Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all. | 
| 
				public  
				string
			 | $CharSet | 
				#
				 The character set of the message. | 
| 
				public  
				string
			 | $ContentType | 
				#
				 The MIME Content-type of the message. | 
| 
				public  
				string
			 | $Encoding | 
				#
				 The message encoding. Options: "8bit", "7bit", "binary", "base64", and "quoted-printable". | 
| 
				public  
				string
			 | $ErrorInfo | 
				#
				 Holds the most recent mailer error message. | 
| 
				public  
				string
			 | $From | 
				#
				 The From email address for the message. | 
| 
				public  
				string
			 | $FromName | 
				#
				 The From name of the message. | 
| 
				public  
				string
			 | $Sender | 
				#
				 The Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. | 
| 
				public  
				string
			 | $ReturnPath | 
				#
				 The Return-Path of the message. If empty, it will be set to either From or Sender. | 
| 
				public  
				string
			 | $Subject | 
				#
				 The Subject of the message. | 
| 
				public  
				string
			 | $Body | 
				#
				 An HTML or plain text message body. If HTML then call isHTML(true). | 
| 
				public  
				string
			 | $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  
				string
			 | $Ical | 
				#
				 An iCal message part body. Only supported in simple alt or alt_inline message types To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator | 
| 
				protected  
				string
			 | $MIMEBody | 
				#
				 The complete compiled MIME message body. | 
| 
				protected  
				string
			 | $MIMEHeader | 
				#
				 The complete compiled MIME message headers. | 
| 
				protected  
				string
			 | $mailHeader | 
				#
				 Extra headers that createHeader() doesn't fold in. | 
| 
				public  
				integer
			 | $WordWrap | 
				#
				 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  
				string
			 | $Mailer | 
				#
				 Which method to use to send mail. Options: "mail", "sendmail", or "smtp". | 
| 
				public  
				string
			 | $Sendmail | 
				#
				 The path to the sendmail program. | 
| 
				public  
				boolean
			 | $UseSendmailOptions | 
				#
				 Whether mail() uses a fully sendmail-compatible MTA. One which supports sendmail's "-oi -f" options. | 
| 
				public  
				string
			 | $PluginDir | 
				#
				 Path to PHPMailer plugins. Useful if the SMTP class is not in the PHP include path. | 
| 
				public  
				string
			 | $ConfirmReadingTo | 
				#
				 The email address that a reading confirmation should be sent to, also known as read receipt. | 
| 
				public  
				string
			 | $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  
				string
			 | $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  
				string
			 | $MessageDate | 
				#
				 The message Date to be used in the Date header. If empty, the current date will be added. | 
| 
				public  
				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"). 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  
				integer
			 | $Port | 
				#
				 The default SMTP server port. | 
| 
				public  
				string
			 | $Helo | 
				#
				 The SMTP HELO of the message. Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find one with the same method described above for $Hostname. | 
| 
				public  
				string
			 | $SMTPSecure | 
				#
				 What kind of encryption to use on the SMTP connection. Options: '', 'ssl' or 'tls' | 
| 
				public  
				boolean
			 | $SMTPAutoTLS | 
				#
				 Whether to enable TLS encryption automatically if a server supports it, even
if  | 
| 
				public  
				boolean
			 | $SMTPAuth | 
				#
				 Whether to use SMTP authentication. Uses the Username and Password properties. | 
| 
				public  
				array
			 | $SMTPOptions | 
				#
				 Options array passed to stream_context_create when connecting via SMTP. | 
| 
				public  
				string
			 | $Username | 
				#
				 SMTP username. | 
| 
				public  
				string
			 | $Password | 
				#
				 SMTP password. | 
| 
				public  
				string
			 | $AuthType | 
				#
				 SMTP auth type. Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified | 
| 
				public  
				string
			 | $Realm | 
				#
				 SMTP realm. Used for NTLM auth | 
| 
				public  
				string
			 | $Workstation | 
				#
				 SMTP workstation. Used for NTLM auth | 
| 
				public  
				integer
			 | $Timeout | 
				#
				 The SMTP server timeout in seconds. Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2 | 
| 
				public  
				integer
			 | $SMTPDebug | 
				#
				 SMTP class debug output mode. Debug output level. Options: 
 | 
| 
				public  
				string|callable
			 | $Debugoutput | 
				#
				 How to handle debug output. Options: 
 | 
| 
				public  
				boolean
			 | $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(). | 
| 
				public  
				boolean
			 | $SingleTo | 
				#
				 Whether to split multiple to addresses into multiple messages or send them
all in one message. Only supported in  | 
| 
				public  
				array
			 | $SingleToArray | 
				#
				 Storage for addresses when SingleTo is enabled. | 
| 
				public  
				boolean
			 | $do_verp | 
				#
				 Whether to generate VERP addresses on send. Only applicable when sending via SMTP. | 
| 
				public  
				boolean
			 | $AllowEmpty | 
				#
				 Whether to allow sending messages with an empty body. | 
| 
				public  
				string
			 | $LE | 
				#
				 The default line ending. | 
| 
				public  
				string
			 | $DKIM_selector | 
				#
				 DKIM selector. | 
| 
				public  
				string
			 | $DKIM_identity | 
				#
				 DKIM Identity. Usually the email address used as the source of the email. | 
| 
				public  
				string
			 | $DKIM_passphrase | 
				#
				 DKIM passphrase. Used if your key is encrypted. | 
| 
				public  
				string
			 | $DKIM_domain | 
				#
				 DKIM signing domain name. | 
| 
				public  
				string
			 | $DKIM_private | 
				#
				 DKIM private key file path. | 
| 
				public  
				string
			 | $DKIM_private_string | 
				#
				 DKIM private key string. If set, takes precedence over
 | 
| 
				public  
				string
			 | $action_function | 
				#
				 Callback Action function name. | 
| 
				public  
				string
			 | $XMailer | 
				#
				 What to put in the X-Mailer header. Options: An empty string for PHPMailer default, whitespace for none, or a string to use | 
| 
				public static 
				string|callable
			 | $validator | 
				#
				 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. | 
| 
				protected  
				 | $smtp | 
				#
				 An instance of the SMTP sender class. | 
| 
				protected  
				array
			 | $to | 
				#
				 The array of 'to' names and addresses. | 
| 
				protected  
				array
			 | $cc | 
				#
				 The array of 'cc' names and addresses. | 
| 
				protected  
				array
			 | $bcc | 
				#
				 The array of 'bcc' names and addresses. | 
| 
				protected  
				array
			 | $ReplyTo | 
				#
				 The array of reply-to names and addresses. | 
| 
				protected  
				array
			 | $all_recipients | 
				#
				 An array of all kinds of addresses. Includes all of $to, $cc, $bcc | 
| 
				protected  
				array
			 | $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  
				array
			 | $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  
				array
			 | $attachment | 
				#
				 The array of attachments. | 
| 
				protected  
				array
			 | $CustomHeader | 
				#
				 The array of custom headers. | 
| 
				protected  
				string
			 | $lastMessageID | 
				#
				 The most recent Message-ID (including angular brackets). | 
| 
				protected  
				string
			 | $message_type | 
				#
				 The message's MIME type. | 
| 
				protected  
				array
			 | $boundary | 
				#
				 The array of MIME boundary strings. | 
| 
				protected  
				array
			 | $language | 
				#
				 The array of available languages. | 
| 
				protected  
				integer
			 | $error_count | 
				#
				 The number of errors encountered. | 
| 
				protected  
				string
			 | $sign_cert_file | 
				#
				 The S/MIME certificate file path. | 
| 
				protected  
				string
			 | $sign_key_file | 
				#
				 The S/MIME key file path. | 
| 
				protected  
				string
			 | $sign_extracerts_file | 
				#
				 The optional S/MIME extra certificates ("CA Chain") file path. | 
| 
				protected  
				string
			 | $sign_key_pass | 
				#
				 The S/MIME password for the key. Used only if the key is encrypted. | 
| 
				protected  
				boolean
			 | $exceptions | 
				#
				 Whether to throw exceptions for errors. | 
| 
				protected  
				string
			 | $uniqueid | 
				#
				 Unique ID used for message ID and boundaries. | 
