PHPMailer.Pro.php

Note, only items with public or protected scope are documented.

Project
see https://sourceforge.net/projects/phpmailerpro/
category Email Transport
package PHPMailerPro
author Andy Prevost
copyright 2004-2023 © Andy Prevost - All Rights Reserved
version 2024.1.2.1
license MIT - Distributed under the MIT License
namespace codeworxtech\PHPMailerPro;
class PHPMailerPro
Properties
scope property default value comments
const ERR_CONTINUE 1;  
const ERR_CRITICAL 9;  
const MAILSEP ", "  
const VERSION '2024.1.2.1'  
const CRLF "\r\n"  
const TIMEVAL 30;  
const PASSMK '✓ ';  
const FAILMK '✗ ';  
protected $language []  
public $charSet UTF-8 Sets message CharSet
@var string
public $confirmReadingTo Sets email address that a "read" confirmation will be sent to
@var string
public $contentType text/plain Sets message Content-type
@var string
public $dkimDomain Required: Used with DKIM DNS Resource Record
syntax: (base domain) 'yourdomain.com'
@var string
public $dkimIdentity Optional: Used with DKIM DNS Resource Record
syntax: 'you@yourdomain.com'
@var string
public $dkimPassphrase Optional: Used with DKIM Digital Signing process
@var string
public $dkimPrivate Required: Used with DKIM DNS Resource Record
private key (read from /.htkey_private)
@var string
public $dkimSelector PHPMailerPro Used with DKIM DNS Resource Record
@var string
public $encoding base64 Sets message Encoding. Options:
"8bit", "7bit", "binary", "base64", and "quoted-printable"
@var string
public $errorInfo Most recent mailer error message
@var string
public $hostname Sets the hostname to use in Message-Id and Received headers
and as default HELO string. If empty, the value returned
by SERVER_NAME is used or 'localhost.localdomain'
@var string
public $imapAddToSent false If true, adds email message to spec'd IMAP Sent box
@var boolean
public $imapHost Outbound IMAP mail server name (ie. mail.yourserver.com)
@var string
public $imapPort 143/imap/notls Outbound IMAP mail server port
@var string
public $imapUsername Outbound IMAP mail server username (ie. name@yourserver.com)
@var string
public $imapPassword Outbound IMAP mail server password
@var string
public $messageHTML Sets HTML portion of message Body
Sets email to multipart/alternative.
@var string
public $messageICal Sets iCalendar/ICS message.
@var string
public $messageText ; Sets text-only body.
Sets email to multipart/alternative.
@var string
public $mimeMail Container for entire mail message
@var string
public $priority 0 Email priority (1 = High, 3 = Normal, 5 = low)
Not sent when set to 0 (default)
@var int
public $returnPath email Return-Path. If not empty, sent via -f or in headers
@var string
public $sender Container for all recipients
@var string
public $senderEmail root@localhost Sets message From email address
@var string
public $senderName No Reply Sets message From name
@var string
public $sendIndividualEmails true Provides the ability to have the TO field process individual
emails, instead of sending to entire TO addresses
@var bool
public $sendmailServerPath Default path of sendmail on the server
@var string
public $subject Sets message Subject
@var string
public $transport Default method to send mail
Options are 'smtp', 'sendmail', 'imap'
NOTE: for Qmail and other sendmail-equivalents set as 'sendmail'
(all include a sendmail wrapper for compatibility)
@var string
public $wordWrapLen 70 Sets word wrapping on the body of the message to a given number
of characters.
@var int
public $smtpAccount [] Contains SMTP account: username and password
@var array
public $smtpDebug 0 Debug level
@var int
public $smtpDomain Account domain (top level domain)
@var string
public $smtpFrom SMTP Mail-From: (email address only)
@var string
public $smtpHost SMTP Host (hostname, MX) example: mail.yourhost.com
@var string
public $smtpKeepAlive false SMTP KeepAlive, triggers a reset if true to prevent the SMTP
server from closing
@var boolean
public $smtpOptions []; Work around to authentication issues
@var array
public $smtpPassword SMTP Account password
@var string
public $smtpPort 587 SMTP Port (supports 587, 25, 2525, 465)
(Note: many providers have deprecated 465)
@var int
public $smtpUsername SMTP Account username
@var string
public $smtpUseverp false VERP = Variable Envelope Return Path (used for bounce handling)
@var boolean
Methods
scope function params comments
public __construct Class Construct
public __destruct Class Destruct
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 = 'base64', $type = '' 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 EmailCheckDuplicate $param Loops through recipients, cc and bcc emails and returns
strings with no duplicates.
@param string
@return string
public GetAttachments Return the current array of attachments
@return array
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
protected GetMsgPart $bkey = "" Builds plain text and HTML portion of message
@return string
protected GetMsgType $type = '' Gets email message type
@return string
public IsError Returns true if an error occurred
@return bool
protected IsExploitPath $path, $opt_exit = false Check file path for possible exploits and vulnerabilities
- exploits: LFI/File manipulation, Directory traversal,
File disclosure, Encoding, RCE
@param string $path Relative or absolute path to a file
@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
public 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 SetWordWrap Set the body wrapping
@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 UTF8CharBoundary $encodedText, $maxLength Finds last character boundary prior to maxLength in a utf-8
quoted (printable) encoded string
Original written by Colin Brown.
@param string $encodedText utf-8 QP text
@param int $maxLength last char boundary prior to length
@return int
public ValidateAddress $email Validate an email address
@param string $email The email address to check
@return boolean
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.