WIP A SubClass of phpMailer adapted for LimeSurvey
package | Default |
---|
__construct(boolean $exceptions = null)
boolean
Should we throw external exceptions?
__destruct()
_mime_types(string $ext = ''): string
string
File extension
string
MIME type of file
addAddress(string $address,string $name = ''): boolean
Throws |
|
---|
string
The email address to send to
string
boolean
true on success, false if address already used or invalid in some way
addAnAddress(string $kind,string $address,string $name = ''): boolean
Addresses that have been added already return false, but do not throw exceptions.
Throws |
|
---|
string
One of 'to', 'cc', 'bcc', or 'ReplyTo'
string
The email address to send, resp. to reply to
string
boolean
true on success, false if address already used or invalid in some way
addAttachementsByType()
addAttachment(string $path,string $name = '',string $encoding = self::ENCODING_BASE64,string $type = '',string $disposition = 'attachment'): boolean
Never use a user-supplied path to a file! Returns false if the file could not be found or read. Explicitly does not support passing URLs; PHPMailer is not an HTTP client. If you need to do that, fetch the resource yourself and pass it in via a local file or string.
Throws |
|
---|
string
Path to the attachment
string
Overrides the attachment name
string
File encoding (see $Encoding)
string
MIME type, e.g. image/jpeg
; determined automatically from $path if not specified
string
Disposition to use
boolean
addBCC(string $address,string $name = ''): boolean
Throws |
|
---|
string
The email address to send to
string
boolean
true on success, false if address already used or invalid in some way
addCC(string $address,string $name = ''): boolean
Throws |
|
---|
string
The email address to send to
string
boolean
true on success, false if address already used or invalid in some way
addCustomHeader(string $name,string|null $value = null)
$name value can be overloaded to contain both header name and value (name:value).
Throws |
|
---|
string
Custom header name
string|null
Header value
addDebug( $str, $level): void
addEmbeddedImage(string $path,string $cid,string $name = '',string $encoding = self::ENCODING_BASE64,string $type = '',string $disposition = 'inline'): boolean
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 in img
tags, for example <img src="cid:mylogo">
.
Never use a user-supplied path to a file!
Throws |
|
---|
string
Path to the attachment
string
Content ID of the attachment; Use this to reference the content when using an embedded image in HTML
string
Overrides the attachment filename
string
File encoding (see $Encoding) defaults to base64
string
File MIME type (by default mapped from the $path
filename's extension)
string
Disposition to use: inline
(default) or attachment
(unlikely you want this – {@see addAttachment()
} instead)
boolean
True on successfully adding an attachment
addOrEnqueueAnAddress(string $kind,string $address,string $name): boolean
Addresses that have been added already return false, but do not throw exceptions.
Throws |
|
---|
string
One of 'to', 'cc', 'bcc', or 'ReplyTo'
string
The email address
string
An optional username associated with the address
boolean
true on success, false if address already used or invalid in some way
addrAppend(string $type,array $addr): string
string
array
An array of recipients, where each recipient is a 2-element indexed array with element 0 containing an address and element 1 containing a name, like: [['joe@example.com', 'Joe User'], ['zoe@example.com', 'Zoe User']]
string
addReplyTo(string $address,string $name = ''): boolean
Throws |
|
---|
string
The email address to reply to
string
boolean
true on success, false if address already used or invalid in some way
addrFormat(array $addr): string
array
A 2-element indexed array, element 0 containing an address, element 1 containing a name like ['joe@example.com', 'Joe User']
string
addStringAttachment(string $string,string $filename,string $encoding = self::ENCODING_BASE64,string $type = '',string $disposition = 'attachment'): boolean
This method can be used to attach ascii or binary data, such as a BLOB record from a database.
Throws |
|
---|
string
String attachment data
string
Name of the attachment
string
File encoding (see $Encoding)
string
File extension (MIME) type
string
Disposition to use
boolean
True on successfully adding an attachment
addStringEmbeddedImage(string $string,string $cid,string $name = '',string $encoding = self::ENCODING_BASE64,string $type = '',string $disposition = 'inline'): boolean
This can include images, sounds, and just about any other document type. If your filename doesn't contain an extension, be sure to set the $type to an appropriate MIME type.
Throws |
|
---|
string
The attachment binary data
string
Content ID of the attachment; Use this to reference the content when using an embedded image in HTML
string
A filename for the attachment. If this contains an extension, PHPMailer will attempt to set a MIME type for the attachment. For example 'file.jpg' would get an 'image/jpeg' MIME type.
string
File encoding (see $Encoding), defaults to 'base64'
string
MIME type - will be used in preference to any automatically derived type
string
Disposition to use
boolean
True on successfully adding an attachment
addUrlsPlaceholders(string|array<mixed,string> $aUrlsPlaceholders): void
string|array<mixed,string>
an array of url placeholder to set automatically
alternativeExists(): boolean
boolean
attachAll(string $disposition_type,string $boundary): string
Returns an empty string on failure.
Throws |
|
---|
string
string
string
attachementExists( $aAttachment)
base64EncodeWrapMB(string $str,string $linebreak = null): string
Adapted from a function by paravoid.
see | http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283 |
---|
string
multi-byte text to wrap encode
string
string to use as linefeed/end-of-line
string
cidExists(string $cid): boolean
string
boolean
clearAddresses()
clearAllRecipients()
clearAttachments()
clearBCCs()
clearCCs()
clearCustomHeaders()
clearQueuedAddresses(string $kind)
string
'to', 'cc', or 'bcc'
clearReplyTos()
createBody(): string
Returns an empty string on failure.
Throws |
|
---|
string
The assembled message body
createHeader(): string
string
The assembled headers
DKIM_Add(string $headers_line,string $subject,string $body): string
Throws |
|
---|
string
Header lines
string
Subject
string
Body
string
DKIM_BodyC(string $body): string
Uses the 'simple' algorithm from RFC6376 section 3.4.3. Canonicalized bodies should always use CRLF, regardless of mailer setting.
see | https://tools.ietf.org/html/rfc6376#section-3.4.3 |
---|
string
Message Body
string
DKIM_HeaderC(string $signHeader): string
Uses the 'relaxed' algorithm from RFC6376 section 3.4.2. Canonicalized headers should always use CRLF, regardless of mailer setting.
see | https://tools.ietf.org/html/rfc6376#section-3.4.2 |
---|
string
Header
string
DKIM_QP(string $txt): string
string
string
DKIM_Sign(string $signHeader): string
Throws |
|
---|
string
string
The DKIM signature value
doCallback(boolean $isSent,array $to,array $cc,array $bcc,string $subject,string $body,string $from,array $extra)
boolean
array
array
array
string
string
string
array
doReplacements(string $string): string
string
wher need to replace
string
edebug(string $str)
Only generates output if debug output is enabled.
see | \PHPMailer\PHPMailer\PHPMailer::Debugoutput\PHPMailer\PHPMailer\PHPMailer::SMTPDebug |
---|---|
string
encodeFile(string $path,string $encoding = self::ENCODING_BASE64): string
Returns an empty string on failure.
string
The full path to the file
string
The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
string
encodeHeader(string $str,string $position = 'text'): string
Picks shortest of Q, B, or none. Result includes folding if needed. See RFC822 definitions for phrase, comment and text positions.
string
The header value to encode
string
What context the string will be used in
string
encodeQ(string $str,string $position = 'text'): string
see | http://tools.ietf.org/html/rfc2047#section-4.2 |
---|
string
the text to encode
string
Where the text is going to be used, see the RFC for what that means
string
encodeQP(string $string): string
According to RFC2045 section 6.7.
string
The text to encode
string
encodeString(string $str,string $encoding = self::ENCODING_BASE64): string
Returns an empty string on failure.
Throws |
|
---|
string
The text to encode
string
The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
string
endBoundary(string $boundary): string
string
string
fileIsAccessible(string $path): boolean
string
A relative or absolute path to a file
boolean
filenameToType(string $filename): string
Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
string
A file name or full path, does not need to exist as a file
string
generateId(): string
string
getAllRecipientAddresses(): array
Before the send() call, queued addresses (i.e. with IDN) are not yet included.
array
getAttachments(): array
array
getBccAddresses(): array
Before the send() call, queued addresses (i.e. with IDN) are not yet included.
array
getBoundary(string $boundary,string $charSet,string $contentType,string $encoding): string
string
string
string
string
string
getCcAddresses(): array
Before the send() call, queued addresses (i.e. with IDN) are not yet included.
array
getCustomHeaders(): array
array
getDebug(string $format = ''): null|string|array
string
(currently only html or null (return array))
null|string|array
getError(): null|string
see | \parent::ErrorInfo |
---|---|
null|string
getEventMessage(): string
string
getFrom(): string
string
from (name
getInstance(integer $reset = self::ResetBase): \LimeMailer
getIsHtml(): boolean
boolean
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.
string
getLE(): string
string
getMailMIME(): string
string
getOAuth(): \PHPMailer\PHPMailer\OAuthTokenProvider
getReplyToAddresses(): array
Before the send() call, queued addresses (i.e. with IDN) are not yet included.
array
getResendEmailVars(): array
array
getSentMIMEMessage(): string
Includes complete headers and body. Only valid post preSend().
see | \PHPMailer\PHPMailer\PHPMailer::preSend() |
---|---|
string
getSmtpErrorMessage(string $base_key): string
string
string
getSMTPInstance(): \PHPMailer\PHPMailer\SMTP
Override this function to load your own SMTP implementation, or set one with setSMTPInstance.
\PHPMailer\PHPMailer\SMTP
getToAddresses(): array
Before the send() call, queued addresses (i.e. with IDN) are not yet included.
array
getTokenReplacements(): array<mixed,string>
array<mixed,string>
getTranslations(): array
array
has8bitChars(string $text): boolean
string
boolean
hasLineLongerThanMax(string $str): boolean
string
boolean
hasMultiBytes(string $str): boolean
string
multi-byte text to wrap encode
boolean
headerLine(string $name,string|integer $value): string
string
string|integer
string
html2text(string $html,boolean|callable $advanced = false): string
This is used by msgHTML(). Note - older versions of this function used a bundled advanced converter which was removed for license reasons in #232. Example usage:
//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();
});
string
The HTML text to convert
boolean|callable
Any boolean value to use the internal converter, or provide your own callable for custom conversion. Never pass user-supplied data into this parameter
string
idnSupported(): boolean
boolean
true
if required functions for IDN support are present
init()
inlineImageExists(): boolean
boolean
isError(): boolean
boolean
True if an error did occur
isHTML(boolean $isHtml = true)
boolean
True for HTML mode
isMail()
isPermittedPath(string $path): boolean
Used to reject URLs and phar files from functions that access local file paths, such as addAttachment.
string
A relative or absolute path to a file
boolean
isQmail()
isSendmail()
isShellSafe(string $string): boolean
Note that escapeshellarg and escapeshellcmd are inadequate for our purposes, especially on Windows.
see | https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report |
---|
string
The string to be validated
boolean
isSMTP()
isValidHost(string $host): boolean
IPv6 addresses must include [], e.g. [::1]
, not just ::1
.
string
The host name or IP address to check
boolean
lang(string $key): string
string
string
mailPassthru(string $to,string $subject,string $body,string $header,string|null $params): boolean
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).
string
To
string
Subject
string
Message Body
string
Additional Header(s)
string|null
Params
boolean
mailSend(string $header,string $body): boolean
see | http://www.php.net/manual/en/book.mail.php |
---|---|
Throws |
|
string
The message headers
string
The message body
boolean
manageEvent( $eventParams = array())
var | specific event parameters to add return boolean|null : sended of not, if null : no action are done by event, can use default action. |
---|---|
mb_pathinfo(string $path,integer|string $options = null): string|array
Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.
see | http://www.php.net/manual/en/function.pathinfo.php#107461 |
---|
string
A filename or path, does not need to exist as a file
integer|string
Either a PATHINFO_* constant, or a string name to return only the specified piece
string|array
msgHTML(string $message,string $basedir = '',boolean|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. Do not source $message content from user input! $basedir is prepended when handling relative URLs, e.g. and must not be empty will look for an image file in $basedir/images/a.png and convert it to inline. If you don't provide a $basedir, relative paths will be left untouched (and thus probably break in email) Converts data-uri images into embedded attachments. If you don't want to apply these transformations to your HTML, just set Body and AltBody directly.
see | \PHPMailer\PHPMailer\PHPMailer::html2text() |
---|---|
Throws |
|
string
HTML message string
string
Absolute path to a base directory to prepend to relative paths to images
boolean|callable
Whether to use the internal HTML to text converter or your own custom converter
string
The transformed message body
normalizeBreaks(string $text,string $breaktype = null): 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.
string
string
What kind of line break to use; defaults to static::$LE
string
parseAddresses(string $addrstr,boolean $useimap = true,string $charset = self::CHARSET_ISO88591): array
Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. Note that quotes in the name part are removed.
see | http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation |
---|
string
The address list string
boolean
Whether to use the IMAP extension to parse the list
string
The charset to use when decoding the address list string.
array
postSend(): boolean
Throws |
|
---|
boolean
preResend( $resendVars): boolean
Throws |
|
---|
array variables needed for a resend [message_type,Subject,uniqueid,boundary[1],boundary[2],boundary[3],MIMEBody]
boolean
preSend(): boolean
Throws |
|
---|
boolean
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:
see | \PHPMailer\PHPMailer\PHPMailer::CharSet |
---|
string
The email address to convert
string
The encoded address in ASCII form
quotedString(string $str): string
see | \PHPMailer\PHPMailer\RFC822 3.4.1 |
---|
string
string
resend( $resendVars): boolean
Throws |
|
---|
array variables needed for a resend [message_type,Subject,uniqueid,boundary[1],boundary[2],boundary[3],MIMEBody]
boolean
rfcDate(): string
string
secureHeader(string $str): string
string
string
Send()
inheritdoc | Disable all sending in demoMode |
---|---|
send(): boolean
Uses the sending method specified by $Mailer.
Throws |
|
---|
boolean
false on error - See the ErrorInfo property for details of the error
sendmailSend(string $header,string $body): boolean
see | \PHPMailer\PHPMailer\PHPMailer::Sendmail |
---|---|
Throws |
|
string
The message headers
string
The message body
boolean
sendMessage(): boolean
boolean
serverHostname(): string
Returns 'localhost.localdomain' if unknown.
string
set(string $name,mixed $value = ''): boolean
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', static::ENCRYPTION_STARTTLS);
is the same as:
$mail->SMTPSecure = static::ENCRYPTION_STARTTLS;
.
string
The property name to set
mixed
The value to set the property to
boolean
setError(string $msg)
string
setFrom(string $address,string $name = '',boolean $auto = true): boolean
Throws |
|
---|
string
string
boolean
Whether to also set the Sender address, defaults to true
boolean
setLanguage(string $langcode = 'en',string $lang_path = ''): boolean
The default language is English.
string
ISO 639-1 2-character language code (e.g. French is "fr") Optionally, the language code can be enhanced with a 4-character script annotation and/or a 2-character country annotation.
string
Path to the language file directory, with trailing separator (slash) Do not set this from user input!
boolean
Returns true if the requested language was loaded, false otherwise.
setLE(string $le)
string
setMessageType()
PHPMailer only supports some preset message types, not arbitrary MIME structures.
setOAuth(\PHPMailer\PHPMailer\OAuthTokenProvider $oauth)
setSMTPInstance(\PHPMailer\PHPMailer\SMTP $smtp): \PHPMailer\PHPMailer\SMTP
setSurvey(integer $surveyId): void
integer
setTo( $addressTo, $name = ''): void
see | self::addAddress |
---|
setToken(string $token): void
Throws |
|
---|
string
setTypeWithRaw(string|null $emailType,string|null $language = null)
string|null
set the rawSubject and rawBody at same time
string|null
forced language
setWordWrap()
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.
sign(string $cert_filename,string $key_filename,string $key_pass,string $extracerts_filename = '')
string
string
string
Password for private key
string
Optional path to chain certificate
smtpClose()
smtpConnect(array $options = null): boolean
Returns false if the operation failed.
uses | |
---|---|
Throws |
|
array
An array of options compatible with stream_context_create()
boolean
smtpSend(string $header,string $body): boolean
Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
see | \PHPMailer\PHPMailer\PHPMailer::setSMTPInstance() to use a different class. |
---|---|
uses | |
Throws |
|
string
The message headers
string
The message body
boolean
stripTrailingWSP(string $text): string
string
string
The text to remove breaks from
textLine(string $value): string
string
string
utf8CharBoundary(string $encodedText,integer $maxLength): integer
Original written by Colin Brown.
string
utf-8 QP text
integer
Find the last character boundary prior to this length
integer
validateAddress(string $address,string|callable $patternselect = null): boolean
Validation patterns supported:
auto
Pick best pattern automatically;pcre8
Use the squiloople.com pattern, requires PCRE > 8.0;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.
string
The email address to check
string|callable
Which pattern to use
boolean
validateAddresses(string $aEmailAddressList,string|callable $patternselect = null): string
returns | array |
---|
string
Email address to check
string|callable
Which pattern to use (default to static::$validator)
string
List with valid email addresses - invalid email addresses are filtered - false if none of the email addresses are valid
validateEncoding(string $encoding): boolean
string
boolean
wrapText(string $message,integer $length,boolean $qp_mode = false): string
For use with mailers that do not automatically perform wrapping and for quoted-printable encoded messages. Original written by philippe.
string
The message to wrap
integer
The line length to wrap to
boolean
Whether to run in Quoted-Printable mode
string
ResetNone
ResetBase
ResetComplete
CHARSET_ASCII
CHARSET_ISO88591
CHARSET_UTF8
CONTENT_TYPE_PLAINTEXT
CONTENT_TYPE_TEXT_CALENDAR
CONTENT_TYPE_TEXT_HTML
CONTENT_TYPE_MULTIPART_ALTERNATIVE
CONTENT_TYPE_MULTIPART_MIXED
CONTENT_TYPE_MULTIPART_RELATED
ENCODING_7BIT
ENCODING_8BIT
ENCODING_BASE64
ENCODING_BINARY
ENCODING_QUOTED_PRINTABLE
ENCRYPTION_STARTTLS
ENCRYPTION_SMTPS
ICAL_METHOD_REQUEST
ICAL_METHOD_PUBLISH
ICAL_METHOD_REPLY
ICAL_METHOD_ADD
ICAL_METHOD_CANCEL
ICAL_METHOD_REFRESH
ICAL_METHOD_COUNTER
ICAL_METHOD_DECLINECOUNTER
VERSION
var |
---|
STOP_MESSAGE
var |
---|
STOP_CONTINUE
var |
---|
STOP_CRITICAL
var |
---|
CRLF
If you want to change line break format, change static::$LE, not this.
FWS
MAIL_MAX_LINE_LENGTH
Background: mail() will sometimes corrupt messages with headers headers longer than 65 chars, see #818.
var |
---|
MAX_LINE_LENGTH
var |
---|
STD_LINE_LENGTH
This length does NOT include the line break 76 means that lines will be 77 or 78 chars depending on whether the line break format is LF or CRLF; both are valid.
var |
---|
surveyId :
mailLanguage :
html :
oToken :
aUrlsPlaceholders :
aReplacements :
emailType :string
var | Current email type, used for updating email raw subject and body for token (in survey) : invite, remind, confirm, register … for survey (admin or not) : admin_notification, admin_responses, savesurveydetails, errorsavingresults other : addadminuser, passwordreminderadminuser, mailsendusergroup … |
---|
string
_aAttachementByType :array<mixed,string>
var |
---|
array<mixed,string>
replaceTokenAttributes :boolean
var | replace token attributes (FIRSTNAME etc …) and replace to TOKEN:XXX by XXXX |
---|
boolean
aAttachements :array
var | Current attachements (as string or array) |
---|---|
see |
array
_bAttachementTypeDone :boolean
var | Current attachements (as string or array) |
---|
boolean
rawSubject :string
var | $rawBody |
---|
string
rawBody :string
var |
---|
string
BodySubjectCharset :string
var | Charset of Body and Subject |
---|---|
see | @CharSet |
string
CharSet :string
var |
---|
string
eventName :
eventMessage :
debug :
validator :string|callable
May be a callable to inject your own validator, but there are several built-in validators. The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option.
see | |
---|---|
var |
string|callable
Priority :integer|null
Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
var |
---|
integer|null
ContentType :string
var |
---|
string
Encoding :string
Options: "8bit", "7bit", "binary", "base64", and "quoted-printable".
var |
---|
string
ErrorInfo :string
var |
---|
string
From :string
var |
---|
string
FromName :string
var |
---|
string
Sender :string
This will usually be turned into a Return-Path header by the receiver,
and is the address that bounces will be sent to.
If not empty, will be passed via -f
to sendmail or as the 'MAIL FROM' value over SMTP.
var |
---|
string
Subject :string
var |
---|
string
Body :string
If HTML then call isHTML(true).
var |
---|
string
AltBody :string
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.
var |
---|
string
Ical :string
Only supported in simple alt or alt_inline message types To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator.
see | |
---|---|
var |
string
IcalMethods :array<mixed,string>
var |
---|
array<mixed,string>
MIMEBody :string
var |
---|
string
MIMEHeader :string
var |
---|
string
mailHeader :string
var |
---|
string
WordWrap :integer
Set to 0 to not wrap. A useful value here is 78, for RFC2822 section 2.1.1 compliance.
see | |
---|---|
var |
integer
Mailer :string
Options: "mail", "sendmail", or "smtp".
var |
---|
string
Sendmail :string
var |
---|
string
UseSendmailOptions :boolean
One which supports sendmail's "-oi -f" options.
var |
---|
boolean
ConfirmReadingTo :string
var |
---|
string
Hostname :string
If empty, PHPMailer attempts to find one with, in order, $_SERVER['SERVER_NAME'], gethostname(), php_uname('n'), or the value 'localhost.localdomain'.
see | |
---|---|
var |
string
MessageID :string
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.
see | |
---|---|
var |
string
MessageDate :string
If empty, the current date will be added.
var |
---|
string
Host :string
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.
var |
---|
string
Port :integer
var |
---|
integer
Helo :string
Default is $Hostname. If $Hostname is empty, PHPMailer attempts to find one with the same method described above for $Hostname.
see | |
---|---|
var |
string
SMTPSecure :string
Options: '', static::ENCRYPTION_STARTTLS, or static::ENCRYPTION_SMTPS.
var |
---|
string
SMTPAutoTLS :boolean
Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
var |
---|
boolean
SMTPAuth :boolean
Uses the Username and Password properties.
see | |
---|---|
var |
boolean
SMTPOptions :array
var |
---|
array
Username :string
var |
---|
string
Password :string
var |
---|
string
AuthType :string
If not specified, the first one from that list that the server supports will be selected.
var |
---|
string
oauth :\PHPMailer\PHPMailer\OAuthTokenProvider
Timeout :integer
Default of 5 minutes (300sec) is from RFC2821 section 4.5.3.2.
var |
---|
integer
dsn :
If you use NEVER all other notifications will be ignored. 'SUCCESS' will notify you when your mail has arrived at its destination. 'FAILURE' will arrive if an error occurred during delivery. 'DELAY' will notify you if there is an unusual delay in delivery, but the actual delivery's outcome (success or failure) is not yet decided.
see | See section 4.1 for more information about NOTIFY |
---|---|
SMTPDebug :integer
Debug output level. Options:
see | No output Client messages Client and server messages As SERVER plus connection status Noisy, low-level data output, rarely needed |
---|---|
var |
integer
Debugoutput :string|callable|\Psr\Log\LoggerInterface
Options:
echo
Output plain-text as-is, appropriate for CLIhtml
Output escaped, line breaks converted to <br>
, appropriate for browser outputerror_log
Output to error log as configured in php.ini
By default PHPMailer will use echo
if run from a cli
or cli-server
SAPI, html
otherwise.
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";};
Alternatively, you can pass in an instance of a PSR-3 compatible logger, though only debug
level output is used:
$mail->Debugoutput = new myPsr3Logger;
see | |
---|---|
var |
string|callable|\Psr\Log\LoggerInterface
SMTPKeepAlive :boolean
If this is set to true then the connection will remain open after a send, and closing the connection will require an explicit call to smtpClose(). It's a good idea to use this if you are sending multiple messages as it reduces overhead. See the mailing list example for how to use it.
var |
---|
boolean
SingleTo :boolean
Only supported in mail
and sendmail
transports, not in SMTP.
var | |
---|---|
deprecated | PHPMailer isn't a mailing list manager! |
boolean
SingleToArray :array
var |
---|
array
do_verp :boolean
Only applicable when sending via SMTP.
see | Postfix VERP info |
---|---|
var |
boolean
AllowEmpty :boolean
var |
---|
boolean
DKIM_selector :string
var |
---|
string
DKIM_identity :string
Usually the email address used as the source of the email.
var |
---|
string
DKIM_passphrase :string
Used if your key is encrypted.
var |
---|
string
DKIM_domain :string
example | |
---|---|
var |
string
DKIM_copyHeaderFields :boolean
var |
---|
boolean
DKIM_extraHeaders :array
example | 'List-Help'] |
---|---|
var |
array
DKIM_private :string
var |
---|
string
DKIM_private_string :string
If set, takes precedence over $DKIM_private
.
var |
---|
string
action_function :string
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: bool $result result of the send action array $to email addresses of the recipients array $cc cc email addresses array $bcc bcc email addresses string $subject the subject string $body the email body string $from email address of sender string $extra extra information of possible use "smtp_transaction_id' => last smtp transaction id
var |
---|
string
XMailer :string|null
Options: An empty string for PHPMailer default, whitespace/null for none, or a string to use.
var |
---|
string|null
smtp :\PHPMailer\PHPMailer\SMTP
to :array
var |
---|
array
cc :array
var |
---|
array
bcc :array
var |
---|
array
ReplyTo :array
var |
---|
array
all_recipients :array
Includes all of $to, $cc, $bcc.
see | |
---|---|
var |
array
RecipientsQueue :array
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.
see | |
---|---|
var |
array
ReplyToQueue :array
In send(), valid and non duplicate entries are moved to $ReplyTo. This array is used only for addresses with IDN.
see | |
---|---|
var |
array
CustomHeader :array
var |
---|
array
lastMessageID :string
var |
---|
string
boundary :array
var |
---|
array
language :array
var |
---|
array
error_count :integer
var |
---|
integer
sign_cert_file :string
var |
---|
string
sign_key_file :string
var |
---|
string
sign_extracerts_file :string
var |
---|
string
sign_key_pass :string
Used only if the key is encrypted.
var |
---|
string
exceptions :boolean
var |
---|
boolean
uniqueid :string
var |
---|
string
LE :string
var |
---|
string