| Project | |||
|---|---|---|---|
| class | PHPMailerPro | ||
| namespace | codeworxtech\PHPMailerPro; | ||
| see | https://sourceforge.net/projects/phpmailerpro/ | ||
| category | Email Transport | ||
| package | PHPMailerPro | ||
| author | Andy Prevost |
||
| copyright | 2004-2026 © Andy Prevost - All Rights Reserved | ||
| version | 2026.6.6.2 | ||
| license | MIT - Distributed under the MIT License | ||
| released | 17 June 2026 @ 21:58 (EST) | ||
| Properties | ||||
|---|---|---|---|---|
| scope | type | property | default value | comments |
| const | CRLF | "\r\n" | ||
| const | ERR_CONTINUE | 1 | echo message, process ok to continue | |
| const | ERR_CRITICAL | 9 | echo message, process die critical error | |
| const | MAILSEP | ", " | ||
| const | VERSION | "2026.6.6.2" | ||
| const | FAILMK | "✗ " | X (fail, used in error messages) | |
| const | PASSMK | "✓ " | checkmark (ok, used in error messages) | |
| const | TIMEVAL | 30 | seconds | |
| protected | array | $language | [] | |
| public | string | $charSet | "UTF-8" | |
| public | string | $contentType | "text/plain" | |
| public | string | $dkimDomain | "" | |
| public | string | $dkimIdentity | "" | |
| public | string | $dkimPassphrase | "" | |
| public | string | $dkimPrivate | "" | |
| public | string | $dkimSelector | "PHPMailerPro" | |
| public | string | $encoding | "base64" | |
| public | string | $errorInfo | "" | |
| public | string | $hostname | "" | |
| public | bool | $imapAddToSent | false | |
| public | string | $imapHost | "" | |
| public | string | $imapPort | "143/imap/notls" | |
| public | string | $imapUsername | "" | |
| public | string | $imapPassword | "" | |
| public | string | $messageHTML | "" | |
| public | string | $messageICal | "" | |
| public | string | $messageText | "" | Sets text-only body. Sets email to multipart/alternative. @var string "To view the message, please use an HTML compatible email viewer!\n"; |
| public | string | $mimeMail | "" | |
| public | int | $priority | 0 | |
| public | string | $returnPath | "" | |
| public | string | $sender | "" | |
| public | string | $senderEmail | "root@localhost" | |
| public | string | $senderName | "No Reply" | |
| public | bool | $sendIndividualEmails | true | |
| public | string | $sendmailServerPath | "" | |
| public | string | $subject | "" | |
| public | string | $transport | "" | |
| public | int | $wordWrapLen | 70 | |
| public | array | $smtpAccount | [] | |
| public | int|bool | $smtpDebug | 0 | |
| public | string | $smtpDomain | "" | |
| public | string | $smtpFrom | "" | |
| public | string | $smtpHost | "" | |
| public | bool | $smtpKeepAlive | false | |
| public | array | $smtpOptions | [] | Work around to authentication issues @var array ['ssl'=>[ 'verify_peer'=>false, 'verify_peer_name'=>false, 'allow_self_signed'=>true ] ]; |
| public | string | $smtpPassword | "" | |
| public | int | $smtpPort | 587 | |
| public | string | $smtpUsername | "" | |
| public | bool | $smtpUseVerp | false | |
| Methods | |||
|---|---|---|---|
| scope | function | params | comments |
| public | __construct | Magic Method - Class Construct | |
| public | __destruct | Magic Method - Class Destruct | |
| public | __invoke | $via = "smtp" | Magic Method - Class Invoke |
| public | AddAttachment | $path, $name = "", $encoding = "base64", $type = "" |
Adds an attachment from a path on the filesystem Returns false if the file could not be found or accessed. @param string $path Path to the attachment @param string $name Overrides the attachment name @param string $encoding File encoding (see $Encoding) @param string $type File extension (MIME) type @return bool |
| public | AddBCC | $param | Adds a "Bcc" email address @param string $email @param string $name @return boolean true on success, false if address already used |
| public | AddCC | $param | Adds a "Cc" address. @param string $email @param string $name @return boolean true on success, false if address already used |
| public | AddCustomHeader | $custom_header | Adds a custom header. @return void |
| public | AddEmbeddedImage | $path, $cid, $name = "", $encoding = "", $type = "", $attach = "" |
Adds an embedded attachment. @param string $path Path to the attachment. @param string $cid Content ID of the attachment. @param string $name Overrides the attachment name. @param string $encoding File encoding (see $Encoding). @param string $type File extension (MIME) type. @return bool |
| public | AddMessageToSent | $folder = "INBOX.Sent", $options = null |
Adds email message to IMAP INBOX.Sent @param string $message (optional) @param string $folder (optional) @param string $options (optional) |
| public | AddRecipient | $param | Adds a "To" address. @param string $address @param string $name @return boolean true on success, false if address already used |
| public | AddReplyTo | $param | Adds a "Reply-to" address. @param string $email @param string $name @return boolean |
| public | AddStringAttachment | $string, $filename, $encoding = "base64", $type = "" |
Adds a string or binary attachment (non-filesystem) to the list. This method can be used to attach ascii or binary data, such as a BLOB record from a database. @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. @return void |
| public | BuildHeader | Builds message header @return string |
|
| public | Clear | Clear all | |
| public | ClearAddresses | Clears all recipients assigned in the TO array. Returns void. @return void |
|
| public | ClearAllRecipients | Clears all recipients assigned in the TO, CC and BCC array. Returns void. @return void |
|
| public | ClearAttachments | Clears all previously set filesystem, string, and binary attachments. Returns void. @return void |
|
| public | ClearBCCs | Clears all recipients assigned in the BCC array. Returns void. @return void |
|
| public | ClearCCs | Clears all recipients assigned in the CC array. Returns void. @return void |
|
| public | ClearCustomHeaders | Clears all custom headers. Returns void. @return void |
|
| public | ClearReplyTos | Clears all recipients assigned in replyTo array. Returns void. @return void |
|
| public | ConfirmReadingTo | $param | Adds a "confirmReadingTo" email address @param string $email @param string $name @return boolean true on success, false if address already used |
| public | DataToHTML | $content, $basedir = "" |
Evaluates the message and returns modifications for inline images and backgrounds @return $message |
| public | DKIMadd | $headers_line, $subject, $body |
Create the DKIM header, body, as new header @param string $headers_line @param string $subject @param string $body |
| public | DKIMbodyC | $body | Generate DKIM Body @param string $body |
| public | DKIMheaderC | $header | Generate DKIM Header @param string $s Header |
| public | DKIMqp | $txt | Set the private key file and password to sign the message @param string $key_filename Parameter File Name @param string $key_pass Password for private key |
| public | DKIMsign | $s | Generate DKIM signature @param string $s Header |
| public | GetMimeType | $resource, $type = "file" |
Gets MIME type of file or string if file: USE ONLY AFTER VERIFYING FILE EXISTS if string: designed for file data read in as string, will not properly detect html vs text returns 'application/octet-stream' if not found (or file encoded) @param string $resource (filename or string) @param string $type ('string' or 'file', defaults to 'file') @return string |
| public | IsError | Returns true if an error occurred @return bool |
|
| protected | IsPathSafe | $path, $opt_exit = false |
Check if file path is safe (real, accessible). @param string $path Relative or absolute path to a file @return bool |
| protected | IsShellSafe | Prevent attacks by disallowing unsafe shell characters. Modified version (Thanks to Paul Buonopane Modification: CRITICAL STOP on NOT safe @param string $email (the string to be tested for shell safety) @return bool |
|
| protected | SafeKeyVal | $param | Filter key/value pairs in language file @param string $param String @return string (trimmed) |
| protected | SafeStr | $str | Filter data (ascii and url-encoded) to prevent header injection @param string $str String @return string (trimmed) |
| public | Send | $via = "smtp" | Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the errorInfo variable to view description of the error. @return bool |
| public | Set | $name, $value = "" |
Set/Reset Class Objects (variables) Usage Example: $mail->set('X-Priority', '3'); @param string $name Parameter Name @param mixed $value Parameter Value |
| protected | SetError | $msg | Adds the error message to the error container @return void |
| public | SetLanguage | $langcode = "en", $lang_path = "language/" |
|
| public | SetSender | $data | Set the senderEmail and senderName properties @param string $email @param string $name @return boolean |
| public | SetSubject | $subject | Set subject @param string $subject The subject of the email |
| public | SetSMTPaccount | $array | Sets SMTP Username and password @return mixed |
| public | SetTypeHTML | $is_type_html = true | Sets message type to HTML DEPRECATED, WILL BE REMOVED IN FUTURE RELEASE @param bool @return void |
| public | Sign | $cert_filename, $key_filename, $key_pass |
Set the private key file and password to sign the message @param string $key_filename Parameter File Name @param string $key_pass Password for private key |
| protected | TransportIMAP | $hdr, $body |
Security to ALL the data and email addresses must occur BEFORE calling this function @return bool |
| protected | TransportSendmail | $hdr, $body |
Sends mail using the Sendmail program @param string $hdr The message headers @param string $body The message body @return bool |
| protected | TransportSMTP | $hdr, $body |
Sends mail via SMTP exit() if there is a bad MAIL FROM, RCPT, or DATA input @param string $hdr Email headers @param string $body Email message @return bool |
| public | WrapText | $message, $length |
Wraps message for use with mailers that do not automatically perform wrapping @param string $message The message to wrap @param integer $length The line length to wrap to @return string |
| public | SMTPconnect | Connect to the server return code: 220 success @return bool |
|
| public | SMTPdata | $hdr, $msg |
Sends header and message to SMTP Server return code: 250 success (possible 251, have to allow for this) @return bool |
| public | SMTPisConnected | Returns true if connected to a server otherwise false @access public @return bool |
|
| public | SMTPquit | Sends QUIT to SMTP Server then closes the stream return code: 221 success @return bool |
|
| public | SMTPrecipient | $param | Sends smtp command RCPT TO Returns true if recipient (email) accepted (false if not) return code: 250 success (possible 251, have to allow for this) @return bool |
| public | SMTPreset | (aborts any transport in progress and keeps connection alive) Implements RFC 821: RSET return code 250 success @return bool |
|
Created using codeworxtech\PHPClassDocumentor by Andy Prevost.