Menu

## PHPMailer
in package

class.phpmailer.php : 31

PHPMailer - PHP email creation and transport class.

##### Tags

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)

### Table of Contents

CRLF = " "
  SMTP RFC standard line ending.
MAX_LINE_LENGTH = 998
  The maximum line length allowed by RFC 2822 section 2.1.1.
STOP_CONTINUE = 1
  Error severity: message, likely ok to continue processing.
STOP_CRITICAL = 2
  Error severity: message, plus full stop, critical error reached.
STOP_MESSAGE = 0
  Error severity: message only, continue processing.
$action_function : string
  Callback Action function name.
$AllowEmpty : bool
  Whether to allow sending messages with an empty body.
$AltBody : string
  The plain-text message body.
$AuthType : string
  SMTP auth type.
$Body : string
  An HTML or plain text message body.
$CharSet : string
  The character set of the message.
$ConfirmReadingTo : string
  The email address that a reading confirmation should be sent to, also known as read receipt.
$ContentType : string
  The MIME Content-type of the message.
$Debugoutput : string|callable
  How to handle debug output.
$DKIM_domain : string
  DKIM signing domain name.
$DKIM_identity : string
  DKIM Identity.
$DKIM_passphrase : string
  DKIM passphrase.
$DKIM_private : string
  DKIM private key file path.
$DKIM_private_string : string
  DKIM private key string.
$DKIM_selector : string
  DKIM selector.
$do_verp : bool
  Whether to generate VERP addresses on send.
$Encoding : string
  The message encoding.
$ErrorInfo : string
  Holds the most recent mailer error message.
$From : string
  The From email address for the message.
$FromName : string
  The From name of the message.
$Helo : string
  The SMTP HELO of the message.
$Host : string
  SMTP hosts.
$Hostname : string
  The hostname to use in the Message-ID header and as default HELO string.
$Ical : string
  An iCal message part body.
$LE : string
  The default line ending.
$Mailer : string
  Which method to use to send mail.
$MessageDate : string
  The message Date to be used in the Date header.
$MessageID : string
  An ID to be used in the Message-ID header.
$Password : string
  SMTP password.
$PluginDir : string
  Path to PHPMailer plugins.
$Port : int
  The default SMTP server port.
$Priority : int
  Email priority.
$Realm : string
  SMTP realm.
$ReturnPath : string
  The Return-Path of the message.
$Sender : string
  The Sender email (Return-Path) of the message.
$Sendmail : string
  The path to the sendmail program.
$SingleTo : bool
  Whether to split multiple to addresses into multiple messages or send them all in one message.
$SingleToArray : array<string|int, mixed>
  Storage for addresses when SingleTo is enabled.
$SMTPAuth : bool
  Whether to use SMTP authentication.
$SMTPAutoTLS : bool
  Whether to enable TLS encryption automatically if a server supports it, even if `SMTPSecure` is not set to 'tls'.
$SMTPDebug : int
  SMTP class debug output mode.
$SMTPKeepAlive : bool
  Whether to keep SMTP connection open after each message.
$SMTPOptions : array<string|int, mixed>
  Options array passed to stream_context_create when connecting via SMTP.
$SMTPSecure : string
  What kind of encryption to use on the SMTP connection.
$Subject : string
  The Subject of the message.
$Timeout : int
  The SMTP server timeout in seconds.
$Username : string
  SMTP username.
$UseSendmailOptions : bool
  Whether mail() uses a fully sendmail-compatible MTA.
$validator : string|callable
  Which validator to use by default when validating email addresses.
$Version : string
  The PHPMailer Version number.
$WordWrap : int
  Word-wrap the message body to this number of chars.
$Workstation : string
  SMTP workstation.
$XMailer : string
  What to put in the X-Mailer header.
$all_recipients : array<string|int, mixed>
  An array of all kinds of addresses.
$attachment : array<string|int, mixed>
  The array of attachments.
$bcc : array<string|int, mixed>
  The array of 'bcc' names and addresses.
$boundary : array<string|int, mixed>
  The array of MIME boundary strings.
$cc : array<string|int, mixed>
  The array of 'cc' names and addresses.
$CustomHeader : array<string|int, mixed>
  The array of custom headers.
$error_count : int
  The number of errors encountered.
$exceptions : bool
  Whether to throw exceptions for errors.
$language : array<string|int, mixed>
  The array of available languages.
$lastMessageID : string
  The most recent Message-ID (including angular brackets).
$mailHeader : string
  Extra headers that createHeader() doesn't fold in.
$message_type : string
  The message's MIME type.
$MIMEBody : string
  The complete compiled MIME message body.
$MIMEHeader : string
  The complete compiled MIME message headers.
$RecipientsQueue : array<string|int, mixed>
  An array of names and addresses queued for validation.
$ReplyTo : array<string|int, mixed>
  The array of reply-to names and addresses.
$ReplyToQueue : array<string|int, mixed>
  An array of reply-to names and addresses queued for validation.
$sign_cert_file : string
  The S/MIME certificate file path.
$sign_extracerts_file : string
  The optional S/MIME extra certificates ("CA Chain") file path.
$sign_key_file : string
  The S/MIME key file path.
$sign_key_pass : string
  The S/MIME password for the key.
$smtp : SMTP
  An instance of the SMTP sender class.
$to : array<string|int, mixed>
  The array of 'to' names and addresses.
$uniqueid : string
  Unique ID used for message ID and boundaries.
__construct() : mixed
  Constructor.
__destruct() : mixed
  Destructor.
_mime_types() : string
  Get the MIME type for a file extension.
addAddress() : bool
  Add a "To" address.
addAttachment() : bool
  Add an attachment from a path on the filesystem.
addBCC() : bool
  Add a "BCC" address.
addCC() : bool
  Add a "CC" address.
addCustomHeader() : mixed
  Add a custom header.
addEmbeddedImage() : bool
  Add an embedded (inline) attachment from a file.
addrAppend() : string
  Create recipient headers.
addReplyTo() : bool
  Add a "Reply-To" address.
addrFormat() : string
  Format an address for use in a message header.
addStringAttachment() : mixed
  Add a string or binary attachment (non-filesystem).
addStringEmbeddedImage() : bool
  Add an embedded stringified attachment.
alternativeExists() : bool
  Check if this message has an alternative body set.
attachmentExists() : bool
  Check if an attachment (non-inline) is present.
base64EncodeWrapMB() : string
  Encode and wrap long multibyte strings for mail headers without breaking lines within a character.
clearAddresses() : mixed
  Clear all To recipients.
clearAllRecipients() : mixed
  Clear all recipient types.
clearAttachments() : mixed
  Clear all filesystem, string, and binary attachments.
clearBCCs() : mixed
  Clear all BCC recipients.
clearCCs() : mixed
  Clear all CC recipients.
clearCustomHeaders() : mixed
  Clear all custom headers.
clearQueuedAddresses() : mixed
  Clear queued addresses of given kind.
clearReplyTos() : mixed
  Clear all ReplyTo recipients.
createBody() : string
  Assemble the message body.
createHeader() : string
  Assemble message headers.
DKIM_Add() : string
  Create the DKIM header and body in a new message header.
DKIM_BodyC() : string
  Generate a DKIM canonicalization body.
DKIM_HeaderC() : string
  Generate a DKIM canonicalization header.
DKIM_QP() : string
  Quoted-Printable-encode a DKIM header.
DKIM_Sign() : string
  Generate a DKIM signature.
encodeHeader() : string
  Encode a header string optimally.
encodeQ() : string
  Encode a string using Q encoding.
encodeQP() : string
  Encode a string in quoted-printable format.
encodeQPphp() : string
  Backward compatibility wrapper for an old QP encoding function that was removed.
encodeString() : string
  Encode a string in requested format.
filenameToType() : string
  Map a file name to a MIME type.
fixEOL() : string
  Ensure consistent line endings in a string.
getAllRecipientAddresses() : array<string|int, mixed>
  Allows for public read access to 'all_recipients' property.
getAttachments() : array<string|int, mixed>
  Return the array of attachments.
getBccAddresses() : array<string|int, mixed>
  Allows for public read access to 'bcc' property.
getCcAddresses() : array<string|int, mixed>
  Allows for public read access to 'cc' property.
getCustomHeaders() : array<string|int, mixed>
  Returns all custom headers.
getLastMessageID() : string
  Return the Message-ID header of the last email.
getMailMIME() : string
  Get the message MIME type headers.
getReplyToAddresses() : array<string|int, mixed>
  Allows for public read access to 'ReplyTo' property.
getSentMIMEMessage() : string
  Returns the whole MIME message.
getSMTPInstance() : SMTP
  Get an instance to use for SMTP operations.
getToAddresses() : array<string|int, mixed>
  Allows for public read access to 'to' property.
getTranslations() : array<string|int, mixed>
  Get the array of strings for the current language.
has8bitChars() : bool
  Does a string contain any 8-bit chars (in any charset)?
hasLineLongerThanMax() : bool
  Detect if a string contains a line longer than the maximum line length allowed.
hasMultiBytes() : bool
  Check if a string contains multi-byte characters.
headerLine() : string
  Format a header line.
html2text() : string
  Convert an HTML string into plain text.
idnSupported() : bool
  Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the "intl" and "mbstring" PHP extensions.
inlineImageExists() : bool
  Check if an inline attachment is present.
isError() : bool
  Check if an error occurred.
isHTML() : mixed
  Sets message type to HTML or plain.
isMail() : mixed
  Send messages using PHP's mail() function.
isQmail() : mixed
  Send messages using qmail.
isSendmail() : mixed
  Send messages using $Sendmail.
isSMTP() : mixed
  Send messages using SMTP.
mb_pathinfo() : string|array<string|int, mixed>
  Multi-byte-safe pathinfo replacement.
msgHTML() : string
  Create a message body from an HTML string.
normalizeBreaks() : string
  Normalize line breaks in a string.
parseAddresses() : array<string|int, mixed>
  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.
postSend() : bool
  Actually send a message.
preSend() : bool
  Prepare a message for sending.
punyencodeAddress() : string
  Converts IDN in given email address to its ASCII form, also known as punycode, if possible.
rfcDate() : string
  Return an RFC 822 formatted date.
secureHeader() : string
  Strip newlines to prevent header injection.
send() : bool
  Create a message and send it.
set() : bool
  Set or reset instance properties.
setFrom() : bool
  Set the From and FromName properties.
setLanguage() : bool
  Set the language for error messages.
setWordWrap() : mixed
  Apply word wrapping to the message body.
sign() : mixed
  Set the public and private key files and password for S/MIME signing.
smtpClose() : mixed
  Close the active SMTP session if one exists.
smtpConnect() : bool
  Initiate a connection to an SMTP server.
textLine() : string
  Return a formatted mail line.
utf8CharBoundary() : int
  Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string.
validateAddress() : bool
  Check that a string looks like an email address.
wrapText() : string
  Word-wrap message.
addAnAddress() : bool
  Add an address to one of the recipient arrays or to the ReplyTo array.
addOrEnqueueAnAddress() : bool
  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().
attachAll() : string
  Attach all file, string, and binary attachments to the message.
doCallback() : mixed
  Perform a callback.
edebug() : mixed
  Output debugging info via user-defined method.
encodeFile() : string
  Encode a file attachment in requested format.
endBoundary() : string
  Return the end of a message boundary.
generateId() : string
  Create unique ID.
getBoundary() : string
  Return the start of a message boundary.
isShellSafe() : bool
  Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
lang() : string
  Get an error message in the current language.
mailSend() : bool
  Send mail using the PHP mail() function.
sendmailSend() : bool
  Send mail using the $Sendmail program.
serverHostname() : string
  Get the server hostname.
setError() : mixed
  Add an error message to the error container.
setMessageType() : mixed
  Set the message type.
smtpSend() : bool
  Send mail via SMTP.
mailPassthru() : bool
  Call mail() in a safe_mode-aware fashion.

### Constants

#### CRLF

class.phpmailer.php : 636

SMTP RFC standard line ending.

`public mixed CRLF = " "`

#### MAX_LINE_LENGTH

class.phpmailer.php : 642

The maximum line length allowed by RFC 2822 section 2.1.1.

`public int MAX_LINE_LENGTH = 998`

#### STOP_CONTINUE

class.phpmailer.php : 628

Error severity: message, likely ok to continue processing.

`public mixed STOP_CONTINUE = 1`

#### STOP_CRITICAL

class.phpmailer.php : 632

Error severity: message, plus full stop, critical error reached.

`public mixed STOP_CRITICAL = 2`

#### STOP_MESSAGE

class.phpmailer.php : 624

Error severity: message only, continue processing.

`public mixed STOP_MESSAGE = 0`

### Properties

#### $action_function

class.phpmailer.php : 463

Callback Action function name.

`public string $action_function = ''`

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: http://www.php.net/is_callable

Parameters: boolean $result result of the send action string $to email address of the recipient string $cc cc email addresses string $bcc bcc email addresses string $subject the subject string $body the email body string $from email address of sender

#### $AllowEmpty

class.phpmailer.php : 393

Whether to allow sending messages with an empty body.

`public bool $AllowEmpty = alse`

#### $AltBody

class.phpmailer.php : 123

The plain-text message body.

`public string $AltBody = ''`

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.

#### $AuthType

class.phpmailer.php : 301

SMTP auth type.

`public string $AuthType = ''`

Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified.

#### $Body

class.phpmailer.php : 114

An HTML or plain text message body.

`public string $Body = ''`

If HTML then call isHTML(true).

#### $CharSet

class.phpmailer.php : 52

The character set of the message.

`public string $CharSet = 'iso-8859-1'`

#### $ConfirmReadingTo

class.phpmailer.php : 194

The email address that a reading confirmation should be sent to, also known as read receipt.

`public string $ConfirmReadingTo = ''`

#### $ContentType

class.phpmailer.php : 58

The MIME Content-type of the message.

`public string $ContentType = 'text/plain'`

#### $Debugoutput

class.phpmailer.php : 354

How to handle debug output.

`public string|callable $Debugoutput = 'echo'`

Options: `echo` Output plain-text as-is, appropriate for CLI `html` Output escaped, line breaks converted to `<br>`, appropriate for browser output `error_log` Output to error log as configured in php.ini.

Alternatively, you can provide a callable expecting two params: a message string and the debug level: `$mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";};`

##### Tags

see
  SMTP::$Debugoutput

#### $DKIM_domain

class.phpmailer.php : 430

DKIM signing domain name.

`public string $DKIM_domain = ''`

##### Tags

example

  'example.com'

#### $DKIM_identity

class.phpmailer.php : 415

DKIM Identity.

`public string $DKIM_identity = ''`

Usually the email address used as the source of the email.

#### $DKIM_passphrase

class.phpmailer.php : 422

DKIM passphrase.

`public string $DKIM_passphrase = ''`

Used if your key is encrypted.

#### $DKIM_private

class.phpmailer.php : 436

DKIM private key file path.

`public string $DKIM_private = ''`

#### $DKIM_private_string

class.phpmailer.php : 443

DKIM private key string.

`public string $DKIM_private_string = ''`

If set, takes precedence over `$DKIM_private`.

#### $DKIM_selector

class.phpmailer.php : 408

DKIM selector.

`public string $DKIM_selector = ''`

#### $do_verp

class.phpmailer.php : 387

Whether to generate VERP addresses on send.

`public bool $do_verp = alse`

Only applicable when sending via SMTP.

##### Tags

see
  https://en.wikipedia.org/wiki/Variable_envelope_return_path
see
  http://www.postfix.org/VERP_README.html

  Postfix VERP info

#### $Encoding

class.phpmailer.php : 65

The message encoding.

`public string $Encoding = '8bit'`

Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".

#### $ErrorInfo

class.phpmailer.php : 71

Holds the most recent mailer error message.

`public string $ErrorInfo = ''`

#### $From

class.phpmailer.php : 77

The From email address for the message.

`public string $From = 'root@localhost'`

#### $FromName

class.phpmailer.php : 83

The From name of the message.

`public string $FromName = 'Root User'`

#### $Helo

class.phpmailer.php : 251

The SMTP HELO of the message.

`public string $Helo = ''`

Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find one with the same method described above for $Hostname.

##### Tags

see
  PHPMailer::$Hostname

#### $Host

class.phpmailer.php : 234

SMTP hosts.

`public string $Host = 'localhost'`

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.

#### $Hostname

class.phpmailer.php : 203

The hostname to use in the Message-ID header and as default HELO string.

`public string $Hostname = ''`

If empty, PHPMailer attempts to find one with, in order, $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value 'localhost.localdomain'.

#### $Ical

class.phpmailer.php : 134

An iCal message part body.

`public string $Ical = ''`

Only supported in simple alt or alt_inline message types To generate iCal events, use the bundled extras/EasyPeasyICS.php class or iCalcreator.

##### Tags

see
  http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
see
  http://kigkonsult.se/iCalcreator/

#### $LE

class.phpmailer.php : 402

The default line ending.

`public string $LE = " "`

##### Tags

note

  The default remains "\n". We force CRLF where we know it must be used via self::CRLF.

#### $Mailer

class.phpmailer.php : 166

Which method to use to send mail.

`public string $Mailer = 'mail'`

Options: "mail", "sendmail", or "smtp".

#### $MessageDate

class.phpmailer.php : 221

The message Date to be used in the Date header.

`public string $MessageDate = ''`

If empty, the current date will be added.

#### $MessageID

class.phpmailer.php : 214

An ID to be used in the Message-ID header.

`public string $MessageID = ''`

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.

##### Tags

see
  https://tools.ietf.org/html/rfc5322#section-3.6.4

#### $Password

class.phpmailer.php : 294

SMTP password.

`public string $Password = ''`

#### $PluginDir

class.phpmailer.php : 188

Path to PHPMailer plugins.

`public string $PluginDir = ''`

Useful if the SMTP class is not in the PHP include path.

##### Tags

deprecated

  should not be needed now there is an autoloader

#### $Port

class.phpmailer.php : 241

The default SMTP server port.

`public int $Port = 25`

##### Tags

TODO

  Why is this needed when the SMTP class takes care of it?

#### $Priority

class.phpmailer.php : 46

Email priority.

`public int $Priority = ull`

Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.

#### $Realm

class.phpmailer.php : 308

SMTP realm.

`public string $Realm = ''`

Used for NTLM auth.

#### $ReturnPath

class.phpmailer.php : 101

The Return-Path of the message.

`public string $ReturnPath = ''`

If empty, it will be set to either From or Sender.

it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.

##### Tags

deprecated

  Email senders should never set a return-path header;

see
  https://tools.ietf.org/html/rfc5321#section-4.4

  RFC5321 reference

#### $Sender

class.phpmailer.php : 90

The Sender email (Return-Path) of the message.

`public string $Sender = ''`

If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.

#### $Sendmail

class.phpmailer.php : 172

The path to the sendmail program.

`public string $Sendmail = '/usr/sbin/sendmail'`

#### $SingleTo

class.phpmailer.php : 370

Whether to split multiple to addresses into multiple messages or send them all in one message.

`public bool $SingleTo = alse`

Only supported in `mail` and `sendmail` transports, not in SMTP.

#### $SingleToArray

class.phpmailer.php : 377

Storage for addresses when SingleTo is enabled.

`public array<string|int, mixed> $SingleToArray = []`

##### Tags

TODO

  This should really not be public

#### $SMTPAuth

class.phpmailer.php : 276

Whether to use SMTP authentication.

`public bool $SMTPAuth = alse`

Uses the Username and Password properties.

##### Tags

see
  PHPMailer::$Username
see
  PHPMailer::$Password

#### $SMTPAutoTLS

class.phpmailer.php : 266

Whether to enable TLS encryption automatically if a server supports it, even if `SMTPSecure` is not set to 'tls'.

`public bool $SMTPAutoTLS = rue`

Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.

#### $SMTPDebug

class.phpmailer.php : 337

SMTP class debug output mode.

`public int $SMTPDebug = 0`

Debug output level. Options: `0` No output `1` Commands `2` Data and commands `3` As 2 plus connection status `4` Low-level data output.

##### Tags

see
  SMTP::$do_debug

#### $SMTPKeepAlive

class.phpmailer.php : 362

Whether to keep SMTP connection open after each message.

`public bool $SMTPKeepAlive = alse`

If this is set to true then to close the connection requires an explicit call to smtpClose().

#### $SMTPOptions

class.phpmailer.php : 282

Options array passed to stream_context_create when connecting via SMTP.

`public array<string|int, mixed> $SMTPOptions = []`

#### $SMTPSecure

class.phpmailer.php : 258

What kind of encryption to use on the SMTP connection.

`public string $SMTPSecure = ''`

Options: '', 'ssl' or 'tls'.

#### $Subject

class.phpmailer.php : 107

The Subject of the message.

`public string $Subject = ''`

#### $Timeout

class.phpmailer.php : 322

The SMTP server timeout in seconds.

`public int $Timeout = 300`

Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2.

#### $Username

class.phpmailer.php : 288

SMTP username.

`public string $Username = ''`

#### $UseSendmailOptions

class.phpmailer.php : 179

Whether mail() uses a fully sendmail-compatible MTA.

`public bool $UseSendmailOptions = rue`

One which supports sendmail's "-oi -f" options.

#### $validator

class.phpmailer.php : 480

Which validator to use by default when validating email addresses.

`public static string|callable $validator = 'auto'`

May be a callable to inject your own validator, but there are several built-in validators.

##### Tags

static
see
  PHPMailer::validateAddress()

#### $Version

class.phpmailer.php : 38

The PHPMailer Version number.

`public string $Version = '5.2.21'`

#### $WordWrap

class.phpmailer.php : 159

Word-wrap the message body to this number of chars.

`public int $WordWrap = 0`

Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.

#### $Workstation

class.phpmailer.php : 315

SMTP workstation.

`public string $Workstation = ''`

Used for NTLM auth.

#### $XMailer

class.phpmailer.php : 470

What to put in the X-Mailer header.

`public string $XMailer = ''`

Options: An empty string for PHPMailer default, whitespace for none, or a string to use.

#### $all_recipients

class.phpmailer.php : 519

An array of all kinds of addresses.

`protected array<string|int, mixed> $all_recipients = []`

Includes all of $to, $cc, $bcc.

##### Tags

see
  PHPMailer::$to

  @see PHPMailer::$cc @see PHPMailer::$bcc

#### $attachment

class.phpmailer.php : 547

The array of attachments.

`protected array<string|int, mixed> $attachment = []`

#### $bcc

class.phpmailer.php : 504

The array of 'bcc' names and addresses.

`protected array<string|int, mixed> $bcc = []`

#### $boundary

class.phpmailer.php : 571

The array of MIME boundary strings.

`protected array<string|int, mixed> $boundary = []`

#### $cc

class.phpmailer.php : 498

The array of 'cc' names and addresses.

`protected array<string|int, mixed> $cc = []`

#### $CustomHeader

class.phpmailer.php : 553

The array of custom headers.

`protected array<string|int, mixed> $CustomHeader = []`

#### $error_count

class.phpmailer.php : 583

The number of errors encountered.

`protected int $error_count = 0`

#### $exceptions

class.phpmailer.php : 614

Whether to throw exceptions for errors.

`protected bool $exceptions = alse`

#### $language

class.phpmailer.php : 577

The array of available languages.

`protected array<string|int, mixed> $language = []`

#### $lastMessageID

class.phpmailer.php : 559

The most recent Message-ID (including angular brackets).

`protected string $lastMessageID = ''`

#### $mailHeader

class.phpmailer.php : 152

Extra headers that createHeader() doesn't fold in.

`protected string $mailHeader = ''`

#### $message_type

class.phpmailer.php : 565

The message's MIME type.

`protected string $message_type = ''`

#### $MIMEBody

class.phpmailer.php : 140

The complete compiled MIME message body.

`protected string $MIMEBody = ''`

#### $MIMEHeader

class.phpmailer.php : 146

The complete compiled MIME message headers.

`protected string $MIMEHeader = ''`

#### $RecipientsQueue

class.phpmailer.php : 531

An array of names and addresses queued for validation.

`protected array<string|int, mixed> $RecipientsQueue = []`

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.

##### Tags

see
  PHPMailer::$to

  @see PHPMailer::$cc @see PHPMailer::$bcc

see
  PHPMailer::$all_recipients

#### $ReplyTo

class.phpmailer.php : 510

The array of reply-to names and addresses.

`protected array<string|int, mixed> $ReplyTo = []`

#### $ReplyToQueue

class.phpmailer.php : 541

An array of reply-to names and addresses queued for validation.

`protected array<string|int, mixed> $ReplyToQueue = []`

In send(), valid and non duplicate entries are moved to $ReplyTo. This array is used only for addresses with IDN.

##### Tags

see
  PHPMailer::$ReplyTo

#### $sign_cert_file

class.phpmailer.php : 589

The S/MIME certificate file path.

`protected string $sign_cert_file = ''`

#### $sign_extracerts_file

class.phpmailer.php : 601

The optional S/MIME extra certificates ("CA Chain") file path.

`protected string $sign_extracerts_file = ''`

#### $sign_key_file

class.phpmailer.php : 595

The S/MIME key file path.

`protected string $sign_key_file = ''`

#### $sign_key_pass

class.phpmailer.php : 608

The S/MIME password for the key.

`protected string $sign_key_pass = ''`

Used only if the key is encrypted.

#### $smtp

class.phpmailer.php : 486

An instance of the SMTP sender class.

`protected SMTP $smtp = ull`

#### $to

class.phpmailer.php : 492

The array of 'to' names and addresses.

`protected array<string|int, mixed> $to = []`

#### $uniqueid

class.phpmailer.php : 620

Unique ID used for message ID and boundaries.

`protected string $uniqueid = ''`

### Methods

#### __construct()

class.phpmailer.php : 649

Constructor.

`public __construct([bool $exceptions = null ]) : mixed`

##### Parameters

$exceptions : bool = null

  Should we throw external exceptions?

##### Return values

mixed —

#### __destruct()

class.phpmailer.php : 659

Destructor.

`public __destruct() : mixed`

##### Return values

mixed —

#### _mime_types()

class.phpmailer.php : 3546

Get the MIME type for a file extension.

`public static _mime_types([string $ext = '' ]) : string`

##### Parameters

$ext : string = ''

  File extension

##### Tags

static

##### Return values

string —

MIME type of file

#### addAddress()

class.phpmailer.php : 809

Add a "To" address.

`public addAddress(string $address[, string $name = '' ]) : bool`

##### Parameters

$address : string

  The email address to send to

$name : string = ''

##### Return values

bool —

true on success, false if address already used or invalid in some way

#### addAttachment()

class.phpmailer.php : 2541

Add an attachment from a path on the filesystem.

`public addAttachment(string $path[, string $name = '' ][, string $encoding = 'base64' ][, string $type = '' ][, string $disposition = 'attachment' ]) : bool`

Returns false if the file could not be found or read.

##### Parameters

$path : string

  path to the attachment

$name : string = ''

  overrides the attachment name

$encoding : string = 'base64'

  file encoding (see $Encoding)

$type : string = ''

  file extension (MIME) type

$disposition : string = 'attachment'

  Disposition to use

##### Tags

throws
  phpmailerException

##### Return values

bool —

#### addBCC()

class.phpmailer.php : 839

Add a "BCC" address.

`public addBCC(string $address[, string $name = '' ]) : bool`

##### Parameters

$address : string

  The email address to send to

$name : string = ''

##### Tags

note:

  This function works with the SMTP mailer on win32, not with the "mail" mailer.

##### Return values

bool —

true on success, false if address already used or invalid in some way

#### addCC()

class.phpmailer.php : 824

Add a "CC" address.

`public addCC(string $address[, string $name = '' ]) : bool`

##### Parameters

$address : string

  The email address to send to

$name : string = ''

##### Tags

note:

  This function works with the SMTP mailer on win32, not with the "mail" mailer.

##### Return values

bool —

true on success, false if address already used or invalid in some way

#### addCustomHeader()

class.phpmailer.php : 3413

Add a custom header.

`public addCustomHeader(string $name[, string $value = null ]) : mixed`

$name value can be overloaded to contain both header name and value (name:value).

##### Parameters

$name : string

  Custom header name

$value : string = null

  Header value

##### Return values

mixed —

#### addEmbeddedImage()

class.phpmailer.php : 3081

Add an embedded (inline) attachment from a file.

`public addEmbeddedImage(string $path, string $cid[, string $name = '' ][, string $encoding = 'base64' ][, string $type = '' ][, string $disposition = 'inline' ]) : bool`

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. the content when using an embedded image in HTML.

##### Parameters

$path : string

  path to the attachment

$cid : string

  Content ID of the attachment; Use this to reference

$name : string = ''

  overrides the attachment name

$encoding : string = 'base64'

  file encoding (see $Encoding)

$type : string = ''

  file MIME type

$disposition : string = 'inline'

  Disposition to use

##### Return values

bool —

True on successfully adding an attachment

#### addrAppend()

class.phpmailer.php : 1853

Create recipient headers.

`public addrAppend(string $type, array<string|int, mixed> $addr) : string`

##### Parameters

$type : string
$addr : array<string|int, mixed>

  An array of recipient,

##### Return values

string —

#### addReplyTo()

class.phpmailer.php : 852

Add a "Reply-To" address.

`public addReplyTo(string $address[, string $name = '' ]) : bool`

##### Parameters

$address : string

  The email address to reply to

$name : string = ''

##### Return values

bool —

true on success, false if address already used or invalid in some way

#### addrFormat()

class.phpmailer.php : 1870

Format an address for use in a message header.

`public addrFormat(array<string|int, mixed> $addr) : string`

##### Parameters

$addr : array<string|int, mixed>

  A 2-element indexed array, element containing an address, element 1 containing a name

##### Return values

string —

#### addStringAttachment()

class.phpmailer.php : 3043

Add a string or binary attachment (non-filesystem).

`public addStringAttachment(string $string, string $filename[, string $encoding = 'base64' ][, string $type = '' ][, string $disposition = 'attachment' ]) : mixed`

This method can be used to attach ascii or binary data, such as a BLOB record from a database.

##### Parameters

$string : string

  string attachment data

$filename : string

  name of the attachment

$encoding : string = 'base64'

  file encoding (see $Encoding)

$type : string = ''

  file extension (MIME) type

$disposition : string = 'attachment'

  Disposition to use

##### Return values

mixed —

#### addStringEmbeddedImage()

class.phpmailer.php : 3130

Add an embedded stringified attachment.

`public addStringEmbeddedImage(string $string, string $cid[, string $name = '' ][, string $encoding = 'base64' ][, string $type = '' ][, string $disposition = 'inline' ]) : bool`

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'. the content when using an embedded image in HTML.

##### Parameters

$string : string

  the attachment binary data

$cid : string

  Content ID of the attachment; Use this to reference

$name : string = ''
$encoding : string = 'base64'

  file encoding (see $Encoding)

$type : string = ''

  MIME type

$disposition : string = 'inline'

  Disposition to use

##### Return values

bool —

True on successfully adding an attachment

#### alternativeExists()

class.phpmailer.php : 3190

Check if this message has an alternative body set.

`public alternativeExists() : bool`

##### Return values

bool —

#### attachmentExists()

class.phpmailer.php : 3174

Check if an attachment (non-inline) is present.

`public attachmentExists() : bool`

##### Return values

bool —

#### base64EncodeWrapMB()

class.phpmailer.php : 2898

Encode and wrap long multibyte strings for mail headers without breaking lines within a character.

`public base64EncodeWrapMB(string $str[, string $linebreak = null ]) : string`

Adapted from a function by paravoid.

##### Parameters

$str : string

  multi-byte text to wrap encode

$linebreak : string = null

  string to use as linefeed/end-of-line

##### Tags

see
  http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283

##### Return values

string —

#### clearAddresses()

class.phpmailer.php : 3213

Clear all To recipients.

`public clearAddresses() : mixed`

##### Return values

mixed —

#### clearAllRecipients()

class.phpmailer.php : 3258

Clear all recipient types.

`public clearAllRecipients() : mixed`

##### Return values

mixed —

#### clearAttachments()

class.phpmailer.php : 3270

Clear all filesystem, string, and binary attachments.

`public clearAttachments() : mixed`

##### Return values

mixed —

#### clearBCCs()

class.phpmailer.php : 3237

Clear all BCC recipients.

`public clearBCCs() : mixed`

##### Return values

mixed —

#### clearCCs()

class.phpmailer.php : 3225

Clear all CC recipients.

`public clearCCs() : mixed`

##### Return values

mixed —

#### clearCustomHeaders()

class.phpmailer.php : 3278

Clear all custom headers.

`public clearCustomHeaders() : mixed`

##### Return values

mixed —

#### clearQueuedAddresses()

class.phpmailer.php : 3200

Clear queued addresses of given kind.

`public clearQueuedAddresses(string $kind) : mixed`

##### Parameters

$kind : string

  'to', 'cc', or 'bcc'

##### Return values

mixed —

#### clearReplyTos()

class.phpmailer.php : 3249

Clear all ReplyTo recipients.

`public clearReplyTos() : mixed`

##### Return values

mixed —

#### createBody()

class.phpmailer.php : 2237

Assemble the message body.

`public createBody() : string`

Returns an empty string on failure.

##### Tags

throws
  phpmailerException

##### Return values

string —

The assembled message body

#### createHeader()

class.phpmailer.php : 2062

Assemble message headers.

`public createHeader() : string`

##### Return values

string —

The assembled headers

#### DKIM_Add()

class.phpmailer.php : 3931

Create the DKIM header and body in a new message header.

`public DKIM_Add(string $headers_line, string $subject, string $body) : string`

##### Parameters

$headers_line : string

  Header lines

$subject : string

  Subject

$body : string

  Body

##### Return values

string —

#### DKIM_BodyC()

class.phpmailer.php : 3906

Generate a DKIM canonicalization body.

`public DKIM_BodyC(string $body) : string`

##### Parameters

$body : string

  Message Body

##### Return values

string —

#### DKIM_HeaderC()

class.phpmailer.php : 3884

Generate a DKIM canonicalization header.

`public DKIM_HeaderC(string $signHeader) : string`

##### Parameters

$signHeader : string

  Header

##### Return values

string —

#### DKIM_QP()

class.phpmailer.php : 3809

Quoted-Printable-encode a DKIM header.

`public DKIM_QP(string $txt) : string`

##### Parameters

$txt : string

##### Return values

string —

#### DKIM_Sign()

class.phpmailer.php : 3833

Generate a DKIM signature.

`public DKIM_Sign(string $signHeader) : string`

##### Parameters

$signHeader : string

##### Tags

throws
  phpmailerException

##### Return values

string —

The DKIM signature value

#### encodeHeader()

class.phpmailer.php : 2796

Encode a header string optimally.

`public encodeHeader(string $str[, string $position = 'text' ]) : string`

Picks shortest of Q, B, quoted-printable or none.

##### Parameters

$str : string
$position : string = 'text'

##### Return values

string —

#### encodeQ()

class.phpmailer.php : 2988

Encode a string using Q encoding.

`public encodeQ(string $str[, string $position = 'text' ]) : string`

##### Parameters

$str : string

  the text to encode

$position : string = 'text'

  Where the text is going to be used, see the RFC for what that means

##### Tags

see
  http://tools.ietf.org/html/rfc2047

##### Return values

string —

#### encodeQP()

class.phpmailer.php : 2943

Encode a string in quoted-printable format.

`public encodeQP(string $string[, int $line_max = 76 ]) : string`

According to RFC2045 section 6.7.

##### Parameters

$string : string

  The text to encode

$line_max : int = 76

  Number of chars allowed on a line before wrapping

##### Tags

see
  http://www.php.net/manual/en/function.quoted-printable-decode.php#89417

  Adapted from this comment

##### Return values

string —

#### encodeQPphp()

class.phpmailer.php : 2969

Backward compatibility wrapper for an old QP encoding function that was removed.

`public encodeQPphp(string $string[, int $line_max = 76 ][, bool $space_conv = false ]) : string`

##### Parameters

$string : string
$line_max : int = 76
$space_conv : bool = false

##### Tags

deprecated

  use encodeQP instead

see
  PHPMailer::encodeQP()

##### Return values

string —

#### encodeString()

class.phpmailer.php : 2758

Encode a string in requested format.

`public encodeString(string $str[, string $encoding = 'base64' ]) : string`

Returns an empty string on failure.

##### Parameters

$str : string

  The text to encode

$encoding : string = 'base64'

  The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

##### Return values

string —

#### filenameToType()

class.phpmailer.php : 3665

Map a file name to a MIME type.

`public static filenameToType(string $filename) : string`

Defaults to 'application/octet-stream', i.e.. arbitrary binary data.

##### Parameters

$filename : string

  A file name or full path, does not need to exist as a file

##### Tags

static

##### Return values

string —

#### fixEOL()

class.phpmailer.php : 3393

Ensure consistent line endings in a string.

`public fixEOL(string $str) : string`

Changes every end of line from CRLF, CR or LF to $this->LE.

##### Parameters

$str : string

  String to fixEOL

##### Return values

string —

#### getAllRecipientAddresses()

class.phpmailer.php : 4072

Allows for public read access to 'all_recipients' property.

`public getAllRecipientAddresses() : array<string|int, mixed>`

##### Tags

note:

  Before the send() call, queued addresses (i.e. with IDN) are not yet included.

##### Return values

array<string|int, mixed> —

#### getAttachments()

class.phpmailer.php : 2586

Return the array of attachments.

`public getAttachments() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### getBccAddresses()

class.phpmailer.php : 4048

Allows for public read access to 'bcc' property.

`public getBccAddresses() : array<string|int, mixed>`

##### Tags

note:

  Before the send() call, queued addresses (i.e. with IDN) are not yet included.

##### Return values

array<string|int, mixed> —

#### getCcAddresses()

class.phpmailer.php : 4036

Allows for public read access to 'cc' property.

`public getCcAddresses() : array<string|int, mixed>`

##### Tags

note:

  Before the send() call, queued addresses (i.e. with IDN) are not yet included.

##### Return values

array<string|int, mixed> —

#### getCustomHeaders()

class.phpmailer.php : 3428

Returns all custom headers.

`public getCustomHeaders() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### getLastMessageID()

class.phpmailer.php : 1066

Return the Message-ID header of the last email.

`public getLastMessageID() : string`

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 values

string —

#### getMailMIME()

class.phpmailer.php : 2158

Get the message MIME type headers.

`public getMailMIME() : string`

##### Return values

string —

#### getReplyToAddresses()

class.phpmailer.php : 4060

Allows for public read access to 'ReplyTo' property.

`public getReplyToAddresses() : array<string|int, mixed>`

##### Tags

note:

  Before the send() call, queued addresses (i.e. with IDN) are not yet included.

##### Return values

array<string|int, mixed> —

#### getSentMIMEMessage()

class.phpmailer.php : 2214

Returns the whole MIME message.

`public getSentMIMEMessage() : string`

Includes complete headers and body. Only valid post preSend().

##### Tags

see
  PHPMailer::preSend()

##### Return values

string —

#### getSMTPInstance()

class.phpmailer.php : 1547

Get an instance to use for SMTP operations.

`public getSMTPInstance() : SMTP`

Override this function to load your own SMTP implementation.

##### Return values

SMTP —

#### getToAddresses()

class.phpmailer.php : 4024

Allows for public read access to 'to' property.

`public getToAddresses() : array<string|int, mixed>`

##### Tags

note:

  Before the send() call, queued addresses (i.e. with IDN) are not yet included.

##### Return values

array<string|int, mixed> —

#### getTranslations()

class.phpmailer.php : 1840

Get the array of strings for the current language.

`public getTranslations() : array<string|int, mixed>`

##### Return values

array<string|int, mixed> —

#### has8bitChars()

class.phpmailer.php : 2881

Does a string contain any 8-bit chars (in any charset)?

`public has8bitChars(string $text) : bool`

##### Parameters

$text : string

##### Return values

bool —

#### hasLineLongerThanMax()

class.phpmailer.php : 4011

Detect if a string contains a line longer than the maximum line length allowed.

`public static hasLineLongerThanMax(string $str) : bool`

##### Parameters

$str : string

##### Tags

static

##### Return values

bool —

#### hasMultiBytes()

class.phpmailer.php : 2864

Check if a string contains multi-byte characters.

`public hasMultiBytes(string $str) : bool`

##### Parameters

$str : string

  multi-byte text to wrap encode

##### Return values

bool —

#### headerLine()

class.phpmailer.php : 2510

Format a header line.

`public headerLine(string $name, string $value) : string`

##### Parameters

$name : string
$value : string

##### Return values

string —

#### html2text()

class.phpmailer.php : 3526

Convert an HTML string into plain text.

`public html2text(string $html[, bool|callable $advanced = false ]) : string`

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(); });` or provide your own callable for custom conversion.

##### Parameters

$html : string

  The HTML text to convert

$advanced : bool|callable = false

  Any boolean value to use the internal converter,

##### Return values

string —

#### idnSupported()

class.phpmailer.php : 1187

Tells whether IDNs (Internationalized Domain Names) are supported or not. This requires the "intl" and "mbstring" PHP extensions.

`public idnSupported() : bool`

##### Return values

bool —

"true" if required functions for IDN support are present

#### inlineImageExists()

class.phpmailer.php : 3158

Check if an inline attachment is present.

`public inlineImageExists() : bool`

##### Return values

bool —

#### isError()

class.phpmailer.php : 3380

Check if an error occurred.

`public isError() : bool`

##### Return values

bool —

true if an error did occur

#### isHTML()

class.phpmailer.php : 746

Sets message type to HTML or plain.

`public isHTML([bool $isHtml = true ]) : mixed`

##### Parameters

$isHtml : bool = true

  true for HTML mode

##### Return values

mixed —

#### isMail()

class.phpmailer.php : 766

Send messages using PHP's mail() function.

`public isMail() : mixed`

##### Return values

mixed —

#### isQmail()

class.phpmailer.php : 789

Send messages using qmail.

`public isQmail() : mixed`

##### Return values

mixed —

#### isSendmail()

class.phpmailer.php : 774

Send messages using $Sendmail.

`public isSendmail() : mixed`

##### Return values

mixed —

#### isSMTP()

class.phpmailer.php : 758

Send messages using SMTP.

`public isSMTP() : mixed`

##### Return values

mixed —

#### mb_pathinfo()

class.phpmailer.php : 3692

Multi-byte-safe pathinfo replacement.

`public static mb_pathinfo(string $path[, int|string $options = null ]) : string|array<string|int, mixed>`

Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. Works similarly to the one in PHP >= 5.2.0 or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2.

##### Parameters

$path : string

  A filename or path, does not need to exist as a file

$options : int|string = null

  Either a PATHINFO_* constant,

##### Tags

static
see
  http://www.php.net/manual/en/function.pathinfo.php#107461

##### Return values

string|array<string|int, mixed> —

#### msgHTML()

class.phpmailer.php : 3447

Create a message body from an HTML string.

`public msgHTML(string $message[, string $basedir = '' ][, bool|callable $advanced = false ]) : string`

Automatically inlines images and creates a plain-text version by converting the HTML, overwriting any existing values in Body and AltBody. $basedir is used when handling relative image paths, e.g. will look for an image file in $basedir/images/a.png and convert it to inline. If you don't want to apply these transformations to your HTML, just set Body and AltBody yourself.

##### Parameters

$message : string

  HTML message string

$basedir : string = ''

  base directory for relative paths to images

$advanced : bool|callable = false

  Whether to use the internal HTML to text converter

##### Return values

string —

$message The transformed message Body

#### normalizeBreaks()

class.phpmailer.php : 3781

Normalize line breaks in a string.

`public static normalizeBreaks(string $text[, string $breaktype = " " ]) : 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.

##### Parameters

$text : string
$breaktype : string = " "

  What kind of line break to use, defaults to CRLF

##### Tags

static

##### Return values

string —

#### parseAddresses()

class.phpmailer.php : 975

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.

`public parseAddresses(string $addrstr[, bool $useimap = true ]) : array<string|int, mixed>`

Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. Note that quotes in the name part are removed.

##### Parameters

$addrstr : string

  The address list string

$useimap : bool = true

  Whether to use the IMAP extension to parse the list

##### Tags

see
  http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php

  A more careful implementation

##### Return values

array<string|int, mixed> —

#### postSend()

class.phpmailer.php : 1356

Actually send a message.

`public postSend() : bool`

Send the email via the selected mechanism.

##### Tags

throws
  phpmailerException

##### Return values

bool —

#### preSend()

class.phpmailer.php : 1260

Prepare a message for sending.

`public preSend() : bool`

##### Tags

throws
  phpmailerException

##### Return values

bool —

#### punyencodeAddress()

class.phpmailer.php : 1207

Converts IDN in given email address to its ASCII form, also known as punycode, if possible.

`public punyencodeAddress(string $address) : string`

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 has characters not allowed in an IDN).

##### Parameters

$address : string

  The email address to convert

##### Tags

see
  PHPMailer::$CharSet

##### Return values

string —

The encoded address in ASCII form

#### rfcDate()

class.phpmailer.php : 3316

Return an RFC 822 formatted date.

`public static rfcDate() : string`

##### Tags

static

##### Return values

string —

#### secureHeader()

class.phpmailer.php : 3764

Strip newlines to prevent header injection.

`public secureHeader(string $str) : string`

##### Parameters

$str : string

##### Return values

string —

#### send()

class.phpmailer.php : 1234

Create a message and send it.

`public send() : bool`

Uses the sending method specified by $Mailer.

##### Tags

throws
  phpmailerException

##### Return values

bool —

false on error - See the ErrorInfo property for details of the error

#### set()

class.phpmailer.php : 3744

Set or reset instance properties.

`public set(string $name[, mixed $value = '' ]) : bool`

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', 'tls');` is the same as: `$mail->SMTPSecure = 'tls';`.

##### Parameters

$name : string

  The property name to set

$value : mixed = ''

  The value to set the property to

##### Tags

TODO

  Should this not be using the __set() magic function?

##### Return values

bool —

#### setFrom()

class.phpmailer.php : 1032

Set the From and FromName properties.

`public setFrom(string $address[, string $name = '' ][, bool $auto = true ]) : bool`

##### Parameters

$address : string
$name : string = ''
$auto : bool = true

  Whether to also set the Sender address, defaults to true

##### Tags

throws
  phpmailerException

##### Return values

bool —

#### setLanguage()

class.phpmailer.php : 1772

Set the language for error messages.

`public setLanguage([string $langcode = 'en' ][, string $lang_path = '' ]) : bool`

Returns false if it cannot load the language file. The default language is English.

##### Parameters

$langcode : string = 'en'

  ISO 639-1 2-character language code (e.g. French is "fr")

$lang_path : string = ''

  Path to the language file directory, with trailing separator (slash)

##### Return values

bool —

#### setWordWrap()

class.phpmailer.php : 2038

Apply word wrapping to the message body.

`public setWordWrap() : mixed`

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.

##### Return values

mixed —

#### sign()

class.phpmailer.php : 3794

Set the public and private key files and password for S/MIME signing.

`public sign(string $cert_filename, string $key_filename, string $key_pass[, string $extracerts_filename = '' ]) : mixed`

##### Parameters

$cert_filename : string
$key_filename : string
$key_pass : string

  Password for private key

$extracerts_filename : string = ''

  Optional path to chain certificate

##### Return values

mixed —

#### smtpClose()

class.phpmailer.php : 1752

Close the active SMTP session if one exists.

`public smtpClose() : mixed`

##### Return values

mixed —

#### smtpConnect()

class.phpmailer.php : 1638

Initiate a connection to an SMTP server.

`public smtpConnect([array<string|int, mixed> $options = null ]) : bool`

Returns false if the operation failed.

##### Parameters

$options : array<string|int, mixed> = null

  An array of options compatible with stream_context_create()

##### Tags

uses
  SMTP
throws
  phpmailerException

##### Return values

bool —

#### textLine()

class.phpmailer.php : 2522

Return a formatted mail line.

`public textLine(string $value) : string`

##### Parameters

$value : string

##### Return values

string —

#### utf8CharBoundary()

class.phpmailer.php : 1994

Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string.

`public utf8CharBoundary(string $encodedText, int $maxLength) : int`

Original written by Colin Brown.

##### Parameters

$encodedText : string

  utf-8 QP text

$maxLength : int

  Find the last character boundary prior to this length

##### Return values

int —

#### validateAddress()

class.phpmailer.php : 1092

Check that a string looks like an email address.

`public static validateAddress(string $address[, string|callable $patternselect = null ]) : bool`

`auto` Pick best pattern automatically; `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; `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: 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.

##### Parameters

$address : string

  The email address to check

$patternselect : string|callable = null

  A selector for the validation pattern to use :

##### Tags

static

##### Return values

bool —

#### wrapText()

class.phpmailer.php : 1894

Word-wrap message.

`public wrapText(string $message, int $length[, bool $qp_mode = false ]) : string`

For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe.

##### Parameters

$message : string

  The message to wrap

$length : int

  The line length to wrap to

$qp_mode : bool = false

  Whether to run in Quoted-Printable mode

##### Return values

string —

#### addAnAddress()

class.phpmailer.php : 922

Add an address to one of the recipient arrays or to the ReplyTo array.

`protected addAnAddress(string $kind, string $address[, string $name = '' ]) : bool`

Addresses that have been added already return false, but do not throw exceptions.

##### Parameters

$kind : string

  One of 'to', 'cc', 'bcc', or 'ReplyTo'

$address : string

  The email address to send, resp. to reply to

$name : string = ''

##### Tags

throws
  phpmailerException

##### Return values

bool —

true on success, false if address already used or invalid in some way

#### addOrEnqueueAnAddress()

class.phpmailer.php : 871

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().

`protected addOrEnqueueAnAddress(string $kind, string $address, string $name) : bool`

Addresses that have been added already return false, but do not throw exceptions.

##### Parameters

$kind : string

  One of 'to', 'cc', 'bcc', or 'ReplyTo'

$address : string

  The email address to send, resp. to reply to

$name : string

##### Tags

throws
  phpmailerException

##### Return values

bool —

true on success, false if address already used or invalid in some way

#### attachAll()

class.phpmailer.php : 2600

Attach all file, string, and binary attachments to the message.

`protected attachAll(string $disposition_type, string $boundary) : string`

Returns an empty string on failure.

##### Parameters

$disposition_type : string
$boundary : string

##### Return values

string —

#### doCallback()

class.phpmailer.php : 4088

Perform a callback.

`protected doCallback(bool $isSent, array<string|int, mixed> $to, array<string|int, mixed> $cc, array<string|int, mixed> $bcc, string $subject, string $body, string $from) : mixed`

##### Parameters

$isSent : bool
$to : array<string|int, mixed>
$cc : array<string|int, mixed>
$bcc : array<string|int, mixed>
$subject : string
$body : string
$from : string

##### Return values

mixed —

#### edebug()

class.phpmailer.php : 708

Output debugging info via user-defined method.

`protected edebug(string $str) : mixed`

Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).

##### Parameters

$str : string

##### Tags

see
  PHPMailer::$Debugoutput
see
  PHPMailer::$SMTPDebug

##### Return values

mixed —

#### encodeFile()

class.phpmailer.php : 2714

Encode a file attachment in requested format.

`protected encodeFile(string $path[, string $encoding = 'base64' ]) : string`

Returns an empty string on failure.

##### Parameters

$path : string

  The full path to the file

$encoding : string = 'base64'

  The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

##### Tags

throws
  phpmailerException

##### Return values

string —

#### endBoundary()

class.phpmailer.php : 2474

Return the end of a message boundary.

`protected endBoundary(string $boundary) : string`

##### Parameters

$boundary : string

##### Return values

string —

#### generateId()

class.phpmailer.php : 2224

Create unique ID.

`protected generateId() : string`

##### Return values

string —

#### getBoundary()

class.phpmailer.php : 2443

Return the start of a message boundary.

`protected getBoundary(string $boundary, string $charSet, string $contentType, string $encoding) : string`

##### Parameters

$boundary : string
$charSet : string
$contentType : string
$encoding : string

##### Return values

string —

#### isShellSafe()

class.phpmailer.php : 1464

Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.

`protected static isShellSafe(string $string) : bool`

Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.

##### Parameters

$string : string

  The string to be validated

##### Tags

see
  https://github.com/PHPMailer/PHPMailer/issues/924

  CVE-2016-10045 bug report

##### Return values

bool —

#### lang()

class.phpmailer.php : 3354

Get an error message in the current language.

`protected lang(string $key) : string`

##### Parameters

$key : string

##### Return values

string —

#### mailSend()

class.phpmailer.php : 1501

Send mail using the PHP mail() function.

`protected mailSend(string $header, string $body) : bool`

##### Parameters

$header : string

  The message headers

$body : string

  The message body

##### Tags

see
  http://www.php.net/manual/en/book.mail.php
throws
  phpmailerException

##### Return values

bool —

#### sendmailSend()

class.phpmailer.php : 1399

Send mail using the $Sendmail program.

`protected sendmailSend(string $header, string $body) : bool`

##### Parameters

$header : string

  The message headers

$body : string

  The message body

##### Tags

see
  PHPMailer::$Sendmail
throws
  phpmailerException

##### Return values

bool —

#### serverHostname()

class.phpmailer.php : 3331

Get the server hostname.

`protected serverHostname() : string`

Returns 'localhost.localdomain' if unknown.

##### Return values

string —

#### setError()

class.phpmailer.php : 3288

Add an error message to the error container.

`protected setError(string $msg) : mixed`

##### Parameters

$msg : string

##### Return values

mixed —

#### setMessageType()

class.phpmailer.php : 2483

Set the message type.

`protected setMessageType() : mixed`

PHPMailer only supports some preset message types, not arbitrary MIME structures.

##### Return values

mixed —

#### smtpSend()

class.phpmailer.php : 1572

Send mail via SMTP.

`protected smtpSend(string $header, string $body) : bool`

Returns false if there is a bad MAIL FROM, RCPT, or DATA input. Uses the PHPMailerSMTP class by default.

##### Parameters

$header : string

  The message headers

$body : string

  The message body

##### Tags

uses
  SMTP
see
  PHPMailer::getSMTPInstance()

  to use a different class.

throws
  phpmailerException

##### Return values

bool —

#### mailPassthru()

class.phpmailer.php : 679

Call mail() in a safe_mode-aware fashion.

`private mailPassthru(string $to, string $subject, string $body, string $header, string $params) : bool`

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).

##### Parameters

$to : string

  To

$subject : string

  Subject

$body : string

  Message Body

$header : string

  Additional Header(s)

$params : string

  Params

##### Return values

bool —

## Search results