Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
moodle_phpmailer Class Reference

Moodle Customised version of the PHPMailer class. More...

Inheritance diagram for moodle_phpmailer:
PHPMailer\PHPMailer\PHPMailer

Public Member Functions

 __construct ()
 Constructor - creates an instance of the PHPMailer class with Moodle defaults.
 
 addAddress ($address, $name='')
 Add a "To" address.
 
 addBCC ($address, $name='')
 Add a "BCC" address.
 
 addCC ($address, $name='')
 Add a "CC" address.
 
 addCustomHeader ($custom_header, $value=null)
 Extended AddCustomHeader function in order to stop duplicate message-ids http://tracker.moodle.org/browse/MDL-3681.
 
 addReplyTo ($address, $name='')
 Add a "Reply-To" address.
 
 encodeHeader ($str, $position='text')
 Use internal moodles own core_text to encode mimeheaders.
 
 getLastMessageID ()
 Return the Message-ID header of the last email.
 
 getSMTPInstance ()
 Get an instance to use for SMTP operations.
 
 isHTML ($isHtml=true)
 Sets message type to HTML or plain.
 
 isMail ()
 Send messages using PHP's mail() function.
 
 isQmail ()
 Send messages using qmail.
 
 isSendmail ()
 Send messages using $Sendmail.
 
 isSMTP ()
 Send messages using SMTP.
 
 postSend ()
 Sends this mail.
 
 preSend ()
 Prepare a message for sending.
 
 punyencodeAddress ($address)
 Converts IDN in given email address to its ASCII form, also known as punycode, if possible.
 
 send ()
 Create a message and send it.
 
 setBoundaries ()
 Set the boundaries to use for delimiting MIME parts.
 
 setFrom ($address, $name='', $auto=true)
 Set the From and FromName properties.
 
 setLanguage ($langcode='en', $lang_path='')
 Set the language for error messages.
 
 setSMTPInstance (SMTP $smtp)
 Provide an instance to use for SMTP operations.
 
 smtpClose ()
 Close the active SMTP session if one exists.
 
 smtpConnect ($options=null)
 Initiate a connection to an SMTP server.
 

Static Public Member Functions

static idnSupported ()
 Tells whether IDNs (Internationalized Domain Names) are supported or not.
 
static parseAddresses ($addrstr, $useimap=true, $charset=self::CHARSET_ISO88591)
 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.
 
static rfcDate ()
 Replaced function to fix tz bug: http://tracker.moodle.org/browse/MDL-12596.
 
static validateAddress ($address, $patternselect=null)
 Check that a string looks like an email address.
 

Public Attributes

string $action_function = ''
 Callback Action function name.
 
bool $AllowEmpty = false
 Whether to allow sending messages with an empty body.
 
string $AltBody = ''
 The plain-text message body.
 
string $AuthType = ''
 SMTP authentication type.
 
string $Body = ''
 An HTML or plain text message body.
 
string $CharSet = self::CHARSET_ISO88591
 The character set of the message.
 
string $ConfirmReadingTo = ''
 The email address that a reading confirmation should be sent to, also known as read receipt.
 
string $ContentType = self::CONTENT_TYPE_PLAINTEXT
 The MIME Content-type of the message.
 
string callable Psr Log LoggerInterface $Debugoutput = 'echo'
 How to handle debug output.
 
bool $DKIM_copyHeaderFields = true
 DKIM Copy header field values for diagnostic use.
 
string $DKIM_domain = ''
 
array $DKIM_extraHeaders = []
 
string $DKIM_identity = ''
 DKIM Identity.
 
string $DKIM_passphrase = ''
 DKIM passphrase.
 
string $DKIM_private = ''
 DKIM private key file path.
 
string $DKIM_private_string = ''
 DKIM private key string.
 
string $DKIM_selector = ''
 DKIM selector.
 
bool $do_verp = false
 Whether to generate VERP addresses on send.
 
 $dsn = ''
 Comma separated list of DSN notifications 'NEVER' under no circumstances a DSN must be returned to the sender.
 
string $Encoding = self::ENCODING_8BIT
 The message encoding.
 
string $ErrorInfo = ''
 Holds the most recent mailer error message.
 
return $foundlang
 
string $From = ''
 The From email address for the message.
 
string $FromName = ''
 The From name of the message.
 
string $Helo = ''
 The SMTP HELO/EHLO name used for the SMTP connection.
 
string $Host = 'localhost'
 SMTP hosts.
 
string $Hostname = ''
 The hostname to use in the Message-ID header and as default HELO string.
 
string $Ical = ''
 An iCal message part body.
 
string $Mailer = 'mail'
 Which method to use to send mail.
 
string $MessageDate = ''
 The message Date to be used in the Date header.
 
string $MessageID = ''
 An ID to be used in the Message-ID header.
 
string $Password = ''
 SMTP password.
 
int $Port = 25
 The default SMTP server port.
 
int null $Priority
 Email priority.
 
string $Sender = ''
 The envelope sender of the message.
 
string $Sendmail = '/usr/sbin/sendmail'
 The path to the sendmail program.
 
bool $SingleTo = false
 Whether to split multiple to addresses into multiple messages or send them all in one message.
 
bool $SMTPAuth = false
 Whether to use SMTP authentication.
 
bool $SMTPAutoTLS = true
 Whether to enable TLS encryption automatically if a server supports it, even if SMTPSecure is not set to 'tls'.
 
int $SMTPDebug = 0
 SMTP class debug output mode.
 
bool $SMTPKeepAlive = false
 Whether to keep the SMTP connection open after each message.
 
array $SMTPOptions = []
 Options array passed to stream_context_create when connecting via SMTP.
 
string $SMTPSecure = ''
 What kind of encryption to use on the SMTP connection.
 
string $Subject = ''
 The Subject of the message.
 
int $Timeout = 300
 The SMTP server timeout in seconds.
 
string $Username = ''
 SMTP username.
 
bool $UseSendmailOptions = true
 Whether mail() uses a fully sendmail-compatible MTA.
 
int $WordWrap = 0
 Word-wrap the message body to this number of chars.
 
string null $XMailer = ''
 What to put in the X-Mailer header.
 
const CHARSET_ASCII = 'us-ascii'
 
const CHARSET_ISO88591 = 'iso-8859-1'
 
const CHARSET_UTF8 = 'utf-8'
 
const CONTENT_TYPE_MULTIPART_ALTERNATIVE = 'multipart/alternative'
 
const CONTENT_TYPE_MULTIPART_MIXED = 'multipart/mixed'
 
const CONTENT_TYPE_MULTIPART_RELATED = 'multipart/related'
 
const CONTENT_TYPE_PLAINTEXT = 'text/plain'
 
const CONTENT_TYPE_TEXT_CALENDAR = 'text/calendar'
 
const CONTENT_TYPE_TEXT_HTML = 'text/html'
 
const CRLF = "\r\n"
 The SMTP standard CRLF line break.
 
const ENCODING_7BIT = '7bit'
 
const ENCODING_8BIT = '8bit'
 
const ENCODING_BASE64 = 'base64'
 
const ENCODING_BINARY = 'binary'
 
const ENCODING_QUOTED_PRINTABLE = 'quoted-printable'
 
const ENCRYPTION_SMTPS = 'ssl'
 
const ENCRYPTION_STARTTLS = 'tls'
 
const FWS = ' '
 "Folding White Space" a white space string used for line folding.
 
const ICAL_METHOD_ADD = 'ADD'
 
const ICAL_METHOD_CANCEL = 'CANCEL'
 
const ICAL_METHOD_COUNTER = 'COUNTER'
 
const ICAL_METHOD_DECLINECOUNTER = 'DECLINECOUNTER'
 
const ICAL_METHOD_PUBLISH = 'PUBLISH'
 
const ICAL_METHOD_REFRESH = 'REFRESH'
 
const ICAL_METHOD_REPLY = 'REPLY'
 
const ICAL_METHOD_REQUEST = 'REQUEST'
 
$this language = $PHPMAILER_LANG
 
int const MAIL_MAX_LINE_LENGTH = 63
 The maximum line length supported by mail().
 
int const MAX_LINE_LENGTH = 998
 The maximum line length allowed by RFC 2822 section 2.1.1.
 
int const STD_LINE_LENGTH = 76
 The lower maximum line length allowed by RFC 2822 section 2.1.1.
 
int const STOP_CONTINUE = 1
 Error severity: message, likely ok to continue processing.
 
int const STOP_CRITICAL = 2
 Error severity: message, plus full stop, critical error reached.
 
int const STOP_MESSAGE = 0
 Error severity: message only, continue processing.
 
string const VERSION = '6.8.0'
 The PHPMailer Version number.
 

Static Public Attributes

static string callable $validator = 'php'
 Which validator to use by default when validating email addresses.
 

Protected Member Functions

 addAnAddress ($kind, $address, $name='')
 Add an address to one of the recipient arrays or to the ReplyTo array.
 
 addOrEnqueueAnAddress ($kind, $address, $name)
 Add an address to one of the recipient arrays or to the ReplyTo array.
 
 edebug ($str)
 Output debugging info via a user-defined method.
 
 mailSend ($header, $body)
 Send mail using the PHP mail() function.
 
 sendmailSend ($header, $body)
 Send mail using the $Sendmail program.
 
 smtpSend ($header, $body)
 Send mail via SMTP.
 

Static Protected Member Functions

static fileIsAccessible ($path)
 Check whether a file path is safe, accessible, and readable.
 
static isPermittedPath ($path)
 Check whether a file path is of a permitted type.
 
static isShellSafe ($string)
 Fix CVE-2016-10033 and CVE-2016-10045 by disallowing potentially unsafe shell characters.
 

Protected Attributes

array $all_recipients = []
 An array of all kinds of addresses.
 
array $attachment = []
 The array of attachments.
 
array $bcc = []
 The array of 'bcc' names and addresses.
 
array $boundary = []
 The array of MIME boundary strings.
 
array $cc = []
 The array of 'cc' names and addresses.
 
array $CustomHeader = []
 The array of custom headers.
 
int $error_count = 0
 The number of errors encountered.
 
bool $exceptions = false
 Whether to throw exceptions for errors.
 
array $language = []
 The array of available text strings for the current language.
 
string $lastMessageID = ''
 The most recent Message-ID (including angular brackets).
 
string $mailHeader = ''
 Extra headers that createHeader() doesn't fold in.
 
string $message_type = ''
 The message's MIME type.
 
string $MIMEBody = ''
 The complete compiled MIME message body.
 
string $MIMEHeader = ''
 The complete compiled MIME message headers.
 
OAuthTokenProvider $oauth
 An implementation of the PHPMailer OAuthTokenProvider interface.
 
array $RecipientsQueue = []
 An array of names and addresses queued for validation.
 
array $ReplyTo = []
 The array of reply-to names and addresses.
 
array $ReplyToQueue = []
 An array of reply-to names and addresses queued for validation.
 
string $sign_cert_file = ''
 The S/MIME certificate file path.
 
string $sign_extracerts_file = ''
 The optional S/MIME extra certificates ("CA Chain") file path.
 
string $sign_key_file = ''
 The S/MIME key file path.
 
string $sign_key_pass = ''
 The S/MIME password for the key.
 
array $SingleToArray = []
 Storage for addresses when SingleTo is enabled.
 
SMTP $smtp
 An instance of the SMTP sender class.
 
array $to = []
 The array of 'to' names and addresses.
 
string $uniqueid = ''
 Unique ID used for message ID and boundaries.
 

Static Protected Attributes

static string[] $IcalMethods
 Value-array of "method" in Contenttype header "text/calendar".
 
static string $LE = self::CRLF
 SMTP RFC standard line ending; Carriage Return, Line Feed.
 

Detailed Description

Moodle Customised version of the PHPMailer class.

This class extends the stock PHPMailer class in order to make sensible configuration choices, and behave in a way which is friendly to moodle.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Since
Moodle 2.0

Member Function Documentation

◆ addAddress()

PHPMailer\PHPMailer\PHPMailer::addAddress ( $address,
$name = '' )
inherited

Add a "To" address.

Parameters
string$addressThe email address to send to
string$name
Exceptions
Exception
Return values
booltrue on success, false if address already used or invalid in some way

◆ addAnAddress()

PHPMailer\PHPMailer\PHPMailer::addAnAddress ( $kind,
$address,
$name = '' )
protectedinherited

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

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

Parameters
string$kindOne of 'to', 'cc', 'bcc', or 'ReplyTo'
string$addressThe email address to send, resp. to reply to
string$name
Exceptions
Exception
Return values
booltrue on success, false if address already used or invalid in some way

◆ addBCC()

PHPMailer\PHPMailer\PHPMailer::addBCC ( $address,
$name = '' )
inherited

Add a "BCC" address.

Parameters
string$addressThe email address to send to
string$name
Exceptions
Exception
Return values
booltrue on success, false if address already used or invalid in some way

◆ addCC()

PHPMailer\PHPMailer\PHPMailer::addCC ( $address,
$name = '' )
inherited

Add a "CC" address.

Parameters
string$addressThe email address to send to
string$name
Exceptions
Exception
Return values
booltrue on success, false if address already used or invalid in some way

◆ addOrEnqueueAnAddress()

PHPMailer\PHPMailer\PHPMailer::addOrEnqueueAnAddress ( $kind,
$address,
$name )
protectedinherited

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

Because PHPMailer can't validate addresses with an IDN without knowing the PHPMailer\$CharSet (that can still be modified after calling this function), addition of such addresses is delayed until send(). Addresses that have been added already return false, but do not throw exceptions.

Parameters
string$kindOne of 'to', 'cc', 'bcc', or 'ReplyTo'
string$addressThe email address
string$nameAn optional username associated with the address
Exceptions
Exception
Return values
booltrue on success, false if address already used or invalid in some way

◆ addReplyTo()

PHPMailer\PHPMailer\PHPMailer::addReplyTo ( $address,
$name = '' )
inherited

Add a "Reply-To" address.

Parameters
string$addressThe email address to reply to
string$name
Exceptions
Exception
Return values
booltrue on success, false if address already used or invalid in some way

◆ edebug()

PHPMailer\PHPMailer\PHPMailer::edebug ( $str)
protectedinherited

Output debugging info via a user-defined method.

Only generates output if debug output is enabled.

See also
PHPMailer\$Debugoutput
PHPMailer\$SMTPDebug
Parameters
string$str

◆ encodeHeader()

moodle_phpmailer::encodeHeader ( $str,
$position = 'text' )

Use internal moodles own core_text to encode mimeheaders.

Fall back to phpmailers inbuilt functions if not

◆ fileIsAccessible()

static PHPMailer\PHPMailer\PHPMailer::fileIsAccessible ( $path)
staticprotectedinherited

Check whether a file path is safe, accessible, and readable.

Parameters
string$pathA relative or absolute path to a file
Return values
bool

◆ getLastMessageID()

PHPMailer\PHPMailer\PHPMailer::getLastMessageID ( )
inherited

Return the Message-ID header of the last email.

Technically this is the value from the last time the headers were created, but it's also the message ID of the last sent message except in pathological cases.

Return values
string

◆ getSMTPInstance()

PHPMailer\PHPMailer\PHPMailer::getSMTPInstance ( )
inherited

Get an instance to use for SMTP operations.

Override this function to load your own SMTP implementation, or set one with setSMTPInstance.

Return values
SMTP

◆ idnSupported()

static PHPMailer\PHPMailer\PHPMailer::idnSupported ( )
staticinherited

Tells whether IDNs (Internationalized Domain Names) are supported or not.

This requires the intl and mbstring PHP extensions.

Return values
booltrue if required functions for IDN support are present

◆ isHTML()

PHPMailer\PHPMailer\PHPMailer::isHTML ( $isHtml = true)
inherited

Sets message type to HTML or plain.

Parameters
bool$isHtmlTrue for HTML mode

◆ isPermittedPath()

static PHPMailer\PHPMailer\PHPMailer::isPermittedPath ( $path)
staticprotectedinherited

Check whether a file path is of a permitted type.

Used to reject URLs and phar files from functions that access local file paths, such as addAttachment.

Parameters
string$pathA relative or absolute path to a file
Return values
bool

◆ isShellSafe()

static PHPMailer\PHPMailer\PHPMailer::isShellSafe ( $string)
staticprotectedinherited

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

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

See also
https://github.com/PHPMailer/PHPMailer/issues/924 CVE-2016-10045 bug report
Parameters
string$stringThe string to be validated
Return values
bool

◆ mailSend()

PHPMailer\PHPMailer\PHPMailer::mailSend ( $header,
$body )
protectedinherited

Send mail using the PHP mail() function.

See also
http://www.php.net/manual/en/book.mail.php
Parameters
string$headerThe message headers
string$bodyThe message body
Exceptions
Exception
Return values
bool

◆ parseAddresses()

static PHPMailer\PHPMailer\PHPMailer::parseAddresses ( $addrstr,
$useimap = true,
$charset = self::CHARSET_ISO88591 )
staticinherited

Parse and validate a string containing one or more RFC822-style comma-separated email addresses of the form "display name <address>" into an array of name/address pairs.

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

See also
http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation
Parameters
string$addrstrThe address list string
bool$useimapWhether to use the IMAP extension to parse the list
string$charsetThe charset to use when decoding the address list string.
Return values
array

◆ postSend()

moodle_phpmailer::postSend ( )

Sends this mail.

This function has been overridden to facilitate unit testing.

Return values
bool

Reimplemented from PHPMailer\PHPMailer\PHPMailer.

◆ preSend()

PHPMailer\PHPMailer\PHPMailer::preSend ( )
inherited

Prepare a message for sending.

Exceptions
Exception
Return values
bool

◆ punyencodeAddress()

PHPMailer\PHPMailer\PHPMailer::punyencodeAddress ( $address)
inherited

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

Important: Address must be passed in same encoding as currently set in PHPMailer\$CharSet. This function silently returns unmodified address if:

  • 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 contains characters not allowed in an IDN).
See also
PHPMailer\$CharSet
Parameters
string$addressThe email address to convert
Return values
stringThe encoded address in ASCII form

◆ send()

PHPMailer\PHPMailer\PHPMailer::send ( )
inherited

Create a message and send it.

Uses the sending method specified by $Mailer.

Exceptions
Exception
Return values
boolfalse on error - See the ErrorInfo property for details of the error

◆ sendmailSend()

PHPMailer\PHPMailer\PHPMailer::sendmailSend ( $header,
$body )
protectedinherited

Send mail using the $Sendmail program.

See also
PHPMailer\$Sendmail
Parameters
string$headerThe message headers
string$bodyThe message body
Exceptions
Exception
Return values
bool

◆ setBoundaries()

PHPMailer\PHPMailer\PHPMailer::setBoundaries ( )
inherited

Set the boundaries to use for delimiting MIME parts.

If you override this, ensure you set all 3 boundaries to unique values. The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies, as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7

Return values
void

◆ setFrom()

PHPMailer\PHPMailer\PHPMailer::setFrom ( $address,
$name = '',
$auto = true )
inherited

Set the From and FromName properties.

Parameters
string$address
string$name
bool$autoWhether to also set the Sender address, defaults to true
Exceptions
Exception
Return values
bool

◆ setLanguage()

PHPMailer\PHPMailer\PHPMailer::setLanguage ( $langcode = 'en',
$lang_path = '' )
inherited

Set the language for error messages.

The default language is English.

Parameters
string$langcodeISO 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$lang_pathPath to the language file directory, with trailing separator (slash) Do not set this from user input!
Return values
boolReturns true if the requested language was loaded, false otherwise.

◆ setSMTPInstance()

PHPMailer\PHPMailer\PHPMailer::setSMTPInstance ( SMTP $smtp)
inherited

Provide an instance to use for SMTP operations.

Return values
SMTP

◆ smtpConnect()

PHPMailer\PHPMailer\PHPMailer::smtpConnect ( $options = null)
inherited

Initiate a connection to an SMTP server.

Returns false if the operation failed.

Parameters
array$optionsAn array of options compatible with stream_context_create()
Exceptions
Exception

@uses PHPMailer\PHPMailer\SMTP

Return values
bool

◆ smtpSend()

PHPMailer\PHPMailer\PHPMailer::smtpSend ( $header,
$body )
protectedinherited

Send mail via SMTP.

Returns false if there is a bad MAIL FROM, RCPT, or DATA input.

See also
PHPMailer\setSMTPInstance() to use a different class.

@uses PHPMailer\PHPMailer\SMTP

Parameters
string$headerThe message headers
string$bodyThe message body
Exceptions
Exception
Return values
bool

◆ validateAddress()

static PHPMailer\PHPMailer\PHPMailer::validateAddress ( $address,
$patternselect = null )
staticinherited

Check that a string looks like an email address.

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.

Parameters
string$addressThe email address to check
string | callable$patternselectWhich pattern to use
Return values
bool

Member Data Documentation

◆ $action_function

string PHPMailer\PHPMailer\PHPMailer::$action_function = ''
inherited

Callback Action function name.

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

◆ $all_recipients

array PHPMailer\PHPMailer\PHPMailer::$all_recipients = []
protectedinherited

An array of all kinds of addresses.

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

See also
PHPMailer\$to
PHPMailer\$cc
PHPMailer\$bcc

◆ $AltBody

string PHPMailer\PHPMailer\PHPMailer::$AltBody = ''
inherited

The plain-text message body.

This body can be read by mail clients that do not have HTML email capability such as mutt & Eudora. Clients that can read HTML will view the normal Body.

◆ $AuthType

string PHPMailer\PHPMailer\PHPMailer::$AuthType = ''
inherited

SMTP authentication type.

Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2. If not specified, the first one from that list that the server supports will be selected.

◆ $Body

string PHPMailer\PHPMailer\PHPMailer::$Body = ''
inherited

An HTML or plain text message body.

If HTML then call isHTML(true).

◆ $Debugoutput

string callable Psr Log LoggerInterface PHPMailer\PHPMailer\PHPMailer::$Debugoutput = 'echo'
inherited

How to handle debug output.

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 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 also
SMTP\$Debugoutput

◆ $DKIM_identity

string PHPMailer\PHPMailer\PHPMailer::$DKIM_identity = ''
inherited

DKIM Identity.

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

◆ $DKIM_passphrase

string PHPMailer\PHPMailer\PHPMailer::$DKIM_passphrase = ''
inherited

DKIM passphrase.

Used if your key is encrypted.

◆ $DKIM_private_string

string PHPMailer\PHPMailer\PHPMailer::$DKIM_private_string = ''
inherited

DKIM private key string.

If set, takes precedence over $DKIM_private.

◆ $do_verp

bool PHPMailer\PHPMailer\PHPMailer::$do_verp = false
inherited

Whether to generate VERP addresses on send.

Only applicable when sending via SMTP.

See also
https://en.wikipedia.org/wiki/Variable_envelope_return_path
http://www.postfix.org/VERP_README.html Postfix VERP info

◆ $dsn

PHPMailer\PHPMailer\PHPMailer::$dsn = ''
inherited

Comma separated list of DSN notifications 'NEVER' under no circumstances a DSN must be returned to the sender.

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 also
https://tools.ietf.org/html/rfc3461 See section 4.1 for more information about NOTIFY

◆ $Encoding

string PHPMailer\PHPMailer\PHPMailer::$Encoding = self::ENCODING_8BIT
inherited

The message encoding.

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

◆ $Helo

string PHPMailer\PHPMailer\PHPMailer::$Helo = ''
inherited

The SMTP HELO/EHLO name used for the SMTP connection.

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

See also
PHPMailer\$Hostname

◆ $Host

string PHPMailer\PHPMailer\PHPMailer::$Host = 'localhost'
inherited

SMTP hosts.

Either a single hostname or multiple semicolon-delimited hostnames. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com"). You can also specify encryption type, for example: (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). Hosts will be tried in order.

◆ $Hostname

string PHPMailer\PHPMailer\PHPMailer::$Hostname = ''
inherited

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

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

See also
PHPMailer\$Helo

◆ $Ical

string PHPMailer\PHPMailer\PHPMailer::$Ical = ''
inherited

An iCal message part body.

Only supported in simple alt or alt_inline message types To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator.

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

◆ $IcalMethods

string [] PHPMailer\PHPMailer\PHPMailer::$IcalMethods
staticprotectedinherited
Initial value:
= [
self::ICAL_METHOD_REQUEST,
self::ICAL_METHOD_PUBLISH,
self::ICAL_METHOD_REPLY,
self::ICAL_METHOD_ADD,
self::ICAL_METHOD_CANCEL,
self::ICAL_METHOD_REFRESH,
self::ICAL_METHOD_COUNTER,
self::ICAL_METHOD_DECLINECOUNTER,
]

Value-array of "method" in Contenttype header "text/calendar".

◆ $Mailer

string PHPMailer\PHPMailer\PHPMailer::$Mailer = 'mail'
inherited

Which method to use to send mail.

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

◆ $MessageDate

string PHPMailer\PHPMailer\PHPMailer::$MessageDate = ''
inherited

The message Date to be used in the Date header.

If empty, the current date will be added.

◆ $MessageID

string PHPMailer\PHPMailer\PHPMailer::$MessageID = ''
inherited

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

If empty, a unique id will be generated. You can set your own, but it must be in the format "<id@domain>", as defined in RFC5322 section 3.6.4 or it will be ignored.

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

◆ $Priority

int null PHPMailer\PHPMailer\PHPMailer::$Priority
inherited

Email priority.

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

◆ $RecipientsQueue

array PHPMailer\PHPMailer\PHPMailer::$RecipientsQueue = []
protectedinherited

An array of names and addresses queued for validation.

In send(), valid and non duplicate entries are moved to $all_recipients and one of $to, $cc, or $bcc. This array is used only for addresses with IDN.

See also
PHPMailer\$to
PHPMailer\$cc
PHPMailer\$bcc
PHPMailer\$all_recipients

◆ $ReplyToQueue

array PHPMailer\PHPMailer\PHPMailer::$ReplyToQueue = []
protectedinherited

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

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

See also
PHPMailer\$ReplyTo

◆ $Sender

string PHPMailer\PHPMailer\PHPMailer::$Sender = ''
inherited

The envelope sender of the message.

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.

◆ $sign_key_pass

string PHPMailer\PHPMailer\PHPMailer::$sign_key_pass = ''
protectedinherited

The S/MIME password for the key.

Used only if the key is encrypted.

◆ $SingleTo

bool PHPMailer\PHPMailer\PHPMailer::$SingleTo = false
inherited

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

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

Deprecated
6.0.0 PHPMailer isn't a mailing list manager!

◆ $SMTPAuth

bool PHPMailer\PHPMailer\PHPMailer::$SMTPAuth = false
inherited

Whether to use SMTP authentication.

Uses the Username and Password properties.

See also
PHPMailer\$Username
PHPMailer\$Password

◆ $SMTPAutoTLS

bool PHPMailer\PHPMailer\PHPMailer::$SMTPAutoTLS = true
inherited

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

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

◆ $SMTPDebug

int PHPMailer\PHPMailer\PHPMailer::$SMTPDebug = 0
inherited

SMTP class debug output mode.

Debug output level. Options:

See also
SMTP\DEBUG_OFF: No output
SMTP\DEBUG_CLIENT: Client messages
SMTP\DEBUG_SERVER: Client and server messages
SMTP\DEBUG_CONNECTION: As SERVER plus connection status
SMTP\DEBUG_LOWLEVEL: Noisy, low-level data output, rarely needed
SMTP\$do_debug

◆ $SMTPKeepAlive

bool PHPMailer\PHPMailer\PHPMailer::$SMTPKeepAlive = false
inherited

Whether to keep the SMTP connection open after each message.

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.

◆ $SMTPSecure

string PHPMailer\PHPMailer\PHPMailer::$SMTPSecure = ''
inherited

What kind of encryption to use on the SMTP connection.

Options: '', static\ENCRYPTION_STARTTLS, or static\ENCRYPTION_SMTPS.

◆ $Timeout

int PHPMailer\PHPMailer\PHPMailer::$Timeout = 300
inherited

The SMTP server timeout in seconds.

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

◆ $UseSendmailOptions

bool PHPMailer\PHPMailer\PHPMailer::$UseSendmailOptions = true
inherited

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

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

◆ $validator

string callable PHPMailer\PHPMailer\PHPMailer::$validator = 'php'
staticinherited

Which validator to use by default when validating email addresses.

May be a callable to inject your own validator, but there are several built-in validators. The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option.

See also
PHPMailer\validateAddress()

◆ $WordWrap

int PHPMailer\PHPMailer\PHPMailer::$WordWrap = 0
inherited

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

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

See also
static\STD_LINE_LENGTH

◆ $XMailer

string null PHPMailer\PHPMailer\PHPMailer::$XMailer = ''
inherited

What to put in the X-Mailer header.

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

◆ CRLF

const PHPMailer\PHPMailer\PHPMailer::CRLF = "\r\n"
inherited

The SMTP standard CRLF line break.

If you want to change line break format, change static\$LE, not this.

◆ MAIL_MAX_LINE_LENGTH

int const PHPMailer\PHPMailer\PHPMailer::MAIL_MAX_LINE_LENGTH = 63
inherited

The maximum line length supported by mail().

Background: mail() will sometimes corrupt messages with headers headers longer than 65 chars, see #818.

◆ STD_LINE_LENGTH

int const PHPMailer\PHPMailer\PHPMailer::STD_LINE_LENGTH = 76
inherited

The lower maximum line length allowed by RFC 2822 section 2.1.1.

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.


The documentation for this class was generated from the following file: