Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
PHPMailer\PHPMailer Namespace Reference

  More...

Classes

class  DSNConfigurator
 Configure PHPMailer with DSN string. More...
 
class  Exception
 PHPMailer exception handler. More...
 
class  OAuth
 OAuth - OAuth2 authentication wrapper class. More...
 
interface  OAuthTokenProvider
 OAuthTokenProvider - OAuth2 token provider interface. More...
 
class  PHPMailer
 PHPMailer - PHP email creation and transport class. More...
 

Functions

static _mime_types ($ext='')
 Get the MIME type for a file extension.
 
 addAttachment ( $path, $name='', $encoding=self::ENCODING_BASE64, $type='', $disposition='attachment')
 Add an attachment from a path on the filesystem.
 
 addCustomHeader ($name, $value=null)
 Add a custom header.
 
 addEmbeddedImage ( $path, $cid, $name='', $encoding=self::ENCODING_BASE64, $type='', $disposition='inline')
 Add an embedded (inline) attachment from a file.
 
 addrAppend ($type, $addr)
 Create recipient headers.
 
 addrFormat ($addr)
 Format an address for use in a message header.
 
 addStringAttachment ( $string, $filename, $encoding=self::ENCODING_BASE64, $type='', $disposition='attachment')
 Add a string or binary attachment (non-filesystem).
 
 addStringEmbeddedImage ( $string, $cid, $name='', $encoding=self::ENCODING_BASE64, $type='', $disposition='inline')
 Add an embedded stringified attachment.
 
 alternativeExists ()
 Check if this message has an alternative body set.
 
 attachAll ($disposition_type, $boundary)
 Attach all file, string, and binary attachments to the message.
 
 attachmentExists ()
 Check if an attachment (non-inline) is present.
 
 base64EncodeWrapMB ($str, $linebreak=null)
 Encode and wrap long multibyte strings for mail headers without breaking lines within a character.
 
 cidExists ($cid)
 Check if an embedded attachment is present with this cid.
 
 clearAddresses ()
 Clear all To recipients.
 
 clearAllRecipients ()
 Clear all recipient types.
 
 clearAttachments ()
 Clear all filesystem, string, and binary attachments.
 
 clearBCCs ()
 Clear all BCC recipients.
 
 clearCCs ()
 Clear all CC recipients.
 
 clearCustomHeaders ()
 Clear all custom headers.
 
 clearQueuedAddresses ($kind)
 Clear queued addresses of given kind.
 
 clearReplyTos ()
 Clear all ReplyTo recipients.
 
 createBody ()
 Assemble the message body.
 
 createHeader ()
 Assemble message headers.
 
 DKIM_Add ($headers_line, $subject, $body)
 Create the DKIM header and body in a new message header.
 
 DKIM_BodyC ($body)
 Generate a DKIM canonicalization body.
 
 DKIM_HeaderC ($signHeader)
 Generate a DKIM canonicalization header.
 
 DKIM_QP ($txt)
 Quoted-Printable-encode a DKIM header.
 
 DKIM_Sign ($signHeader)
 Generate a DKIM signature.
 
 doCallback ($isSent, $to, $cc, $bcc, $subject, $body, $from, $extra)
 Perform a callback.
 
 encodeFile ($path, $encoding=self::ENCODING_BASE64)
 Encode a file attachment in requested format.
 
 encodeHeader ($str, $position='text')
 Encode a header value (not including its label) optimally.
 
 encodeQ ($str, $position='text')
 Encode a string using Q encoding.
 
 encodeQP ($string)
 Encode a string in quoted-printable format.
 
 encodeString ($str, $encoding=self::ENCODING_BASE64)
 Encode a string in requested format.
 
 endBoundary ($boundary)
 Return the end of a message boundary.
 
static filenameToType ($filename)
 Map a file name to a MIME type.
 
 generateId ()
 Create a unique ID to use for boundaries.
 
 getAllRecipientAddresses ()
 Allows for public read access to 'all_recipients' property.
 
 getAttachments ()
 Return the array of attachments.
 
 getBccAddresses ()
 Allows for public read access to 'bcc' property.
 
 getBoundaries ()
 Get the boundaries that this message will use.
 
 getBoundary ($boundary, $charSet, $contentType, $encoding)
 Return the start of a message boundary.
 
 getCcAddresses ()
 Allows for public read access to 'cc' property.
 
 getCustomHeaders ()
 Returns all custom headers.
 
static getLE ()
 Return the current line break format string.
 
 getMailMIME ()
 Get the message MIME type headers.
 
 getOAuth ()
 Get the OAuthTokenProvider instance.
 
 getReplyToAddresses ()
 Allows for public read access to 'ReplyTo' property.
 
 getSentMIMEMessage ()
 Returns the whole MIME message.
 
 getToAddresses ()
 Allows for public read access to 'to' property.
 
 getTranslations ()
 Get the array of strings for the current language.
 
 has8bitChars ($text)
 Does a string contain any 8-bit chars (in any charset)?
 
static hasLineLongerThanMax ($str)
 Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2.1.1.
 
 hasMultiBytes ($str)
 Check if a string contains multi-byte characters.
 
 headerLine ($name, $value)
 Format a header line.
 
 html2text ($html, $advanced=false)
 Convert an HTML string into plain text.
 
 inlineImageExists ()
 Check if an inline attachment is present.
 
 isError ()
 Check if an error occurred.
 
static isValidHost ($host)
 Validate whether a string contains a valid value to use as a hostname or IP address.
 
 lang ($key)
 Get an error message in the current language.
 
static mb_pathinfo ($path, $options=null)
 Multi-byte-safe pathinfo replacement.
 
 msgHTML ($message, $basedir='', $advanced=false)
 Create a message body from an HTML string.
 
static normalizeBreaks ($text, $breaktype=null)
 Normalize line breaks in a string.
 
static quotedString ($str)
 If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash.
 
static rfcDate ()
 Return an RFC 822 formatted date.
 
 secureHeader ($str)
 Strip newlines to prevent header injection.
 
 serverHostname ()
 Get the server hostname.
 
 set ($name, $value='')
 Set or reset instance properties.
 
 setError ($msg)
 Add an error message to the error container.
 
static setLE ($le)
 Set the line break format string, e.g.
 
 setMessageType ()
 Set the message type.
 
 setOAuth (OAuthTokenProvider $oauth)
 Set an OAuthTokenProvider instance.
 
 setWordWrap ()
 Apply word wrapping to the message body.
 
 sign ($cert_filename, $key_filename, $key_pass, $extracerts_filename='')
 Set the public and private key files and password for S/MIME signing.
 
static stripTrailingBreaks ($text)
 Strip trailing line breaks from a string.
 
static stripTrailingWSP ($text)
 Remove trailing whitespace from a string.
 
 textLine ($value)
 Return a formatted mail line.
 
 utf8CharBoundary ($encodedText, $maxLength)
 Find the last character boundary prior to $maxLength in a utf-8 quoted-printable encoded string.
 
 validateEncoding ($encoding)
 Validate encodings.
 
 wrapText ($message, $length, $qp_mode=false)
 Word-wrap message.
 

Variables

$this AltBody = static::normalizeBreaks($this->html2text($message, $advanced))
 
$this Body = static::normalizeBreaks($message)
 

Detailed Description

 

Function Documentation

◆ _mime_types()

static PHPMailer\PHPMailer\_mime_types ( $ext = '')
static

Get the MIME type for a file extension.

Parameters
string$extFile extension
Return values
stringMIME type of file

◆ addAttachment()

PHPMailer\PHPMailer\addAttachment ( $path,
$name = '',
$encoding = self::ENCODING_BASE64,
$type = '',
$disposition = 'attachment' )

Add an attachment from a path on the filesystem.

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.

Parameters
string$pathPath to the attachment
string$nameOverrides the attachment name
string$encodingFile encoding (see $Encoding)
string$typeMIME type, e.g. image/jpeg; determined automatically from $path if not specified
string$dispositionDisposition to use
Exceptions
Exception
Return values
bool

◆ addCustomHeader()

PHPMailer\PHPMailer\addCustomHeader ( $name,
$value = null )

Add a custom header.

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

Parameters
string$nameCustom header name
string | null$valueHeader value
Return values
boolTrue if a header was set successfully
Exceptions
Exception

◆ addEmbeddedImage()

PHPMailer\PHPMailer\addEmbeddedImage ( $path,
$cid,
$name = '',
$encoding = self::ENCODING_BASE64,
$type = '',
$disposition = 'inline' )

Add an embedded (inline) attachment from a file.

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!

Parameters
string$pathPath to the attachment
string$cidContent ID of the attachment; Use this to reference the content when using an embedded image in HTML
string$nameOverrides the attachment filename
string$encodingFile encoding (see $Encoding) defaults to base64
string$typeFile MIME type (by default mapped from the $path filename's extension)
string$dispositionDisposition to use: inline (default) or attachment (unlikely you want this – {
See also
addAttachment()} instead)
Return values
boolTrue on successfully adding an attachment
Exceptions
Exception

◆ addrAppend()

PHPMailer\PHPMailer\addrAppend ( $type,
$addr )

Create recipient headers.

Parameters
string$type
array$addrAn 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@e.nosp@m.xamp.nosp@m.le.co.nosp@m.m', 'Joe User'], ['zoe@e.nosp@m.xamp.nosp@m.le.co.nosp@m.m', 'Zoe User']]
Return values
string

◆ addrFormat()

PHPMailer\PHPMailer\addrFormat ( $addr)

Format an address for use in a message header.

Parameters
array$addrA 2-element indexed array, element 0 containing an address, element 1 containing a name like ['joe@e.nosp@m.xamp.nosp@m.le.co.nosp@m.m', 'Joe User']
Return values
string

◆ addStringAttachment()

PHPMailer\PHPMailer\addStringAttachment ( $string,
$filename,
$encoding = self::ENCODING_BASE64,
$type = '',
$disposition = 'attachment' )

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

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

Parameters
string$stringString attachment data
string$filenameName of the attachment
string$encodingFile encoding (see $Encoding)
string$typeFile extension (MIME) type
string$dispositionDisposition to use
Exceptions
Exception
Return values
boolTrue on successfully adding an attachment

◆ addStringEmbeddedImage()

PHPMailer\PHPMailer\addStringEmbeddedImage ( $string,
$cid,
$name = '',
$encoding = self::ENCODING_BASE64,
$type = '',
$disposition = 'inline' )

Add an embedded stringified attachment.

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.

Parameters
string$stringThe attachment binary data
string$cidContent ID of the attachment; Use this to reference the content when using an embedded image in HTML
string$nameA 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$encodingFile encoding (see $Encoding), defaults to 'base64'
string$typeMIME type - will be used in preference to any automatically derived type
string$dispositionDisposition to use
Exceptions
Exception
Return values
boolTrue on successfully adding an attachment

◆ alternativeExists()

PHPMailer\PHPMailer\alternativeExists ( )

Check if this message has an alternative body set.

Return values
bool

◆ attachAll()

PHPMailer\PHPMailer\attachAll ( $disposition_type,
$boundary )
protected

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

Returns an empty string on failure.

Parameters
string$disposition_type
string$boundary
Exceptions
Exception
Return values
string

◆ attachmentExists()

PHPMailer\PHPMailer\attachmentExists ( )

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

Return values
bool

◆ base64EncodeWrapMB()

PHPMailer\PHPMailer\base64EncodeWrapMB ( $str,
$linebreak = null )

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

Adapted from a function by paravoid.

See also
http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283
Parameters
string$strmulti-byte text to wrap encode
string$linebreakstring to use as linefeed/end-of-line
Return values
string

◆ cidExists()

PHPMailer\PHPMailer\cidExists ( $cid)
protected

Check if an embedded attachment is present with this cid.

Parameters
string$cid
Return values
bool

◆ clearQueuedAddresses()

PHPMailer\PHPMailer\clearQueuedAddresses ( $kind)

Clear queued addresses of given kind.

Parameters
string$kind'to', 'cc', or 'bcc'

◆ createBody()

PHPMailer\PHPMailer\createBody ( )

Assemble the message body.

Returns an empty string on failure.

Exceptions
Exception
Return values
stringThe assembled message body

◆ createHeader()

PHPMailer\PHPMailer\createHeader ( )

Assemble message headers.

Return values
stringThe assembled headers

◆ DKIM_Add()

PHPMailer\PHPMailer\DKIM_Add ( $headers_line,
$subject,
$body )

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

Parameters
string$headers_lineHeader lines
string$subjectSubject
string$bodyBody
Exceptions
Exception
Return values
string

◆ DKIM_BodyC()

PHPMailer\PHPMailer\DKIM_BodyC ( $body)

Generate a DKIM canonicalization body.

Uses the 'simple' algorithm from RFC6376 section 3.4.3. Canonicalized bodies should always use CRLF, regardless of mailer setting.

See also
https://tools.ietf.org/html/rfc6376#section-3.4.3
Parameters
string$bodyMessage Body
Return values
string

◆ DKIM_HeaderC()

PHPMailer\PHPMailer\DKIM_HeaderC ( $signHeader)

Generate a DKIM canonicalization header.

Uses the 'relaxed' algorithm from RFC6376 section 3.4.2. Canonicalized headers should always use CRLF, regardless of mailer setting.

See also
https://tools.ietf.org/html/rfc6376#section-3.4.2
Parameters
string$signHeaderHeader
Return values
string

◆ DKIM_QP()

PHPMailer\PHPMailer\DKIM_QP ( $txt)

Quoted-Printable-encode a DKIM header.

Parameters
string$txt
Return values
string

◆ DKIM_Sign()

PHPMailer\PHPMailer\DKIM_Sign ( $signHeader)

Generate a DKIM signature.

Parameters
string$signHeader
Exceptions
Exception
Return values
stringThe DKIM signature value

◆ doCallback()

PHPMailer\PHPMailer\doCallback ( $isSent,
$to,
$cc,
$bcc,
$subject,
$body,
$from,
$extra )
protected

Perform a callback.

Parameters
bool$isSent
array$to
array$cc
array$bcc
string$subject
string$body
string$from
array$extra

◆ encodeFile()

PHPMailer\PHPMailer\encodeFile ( $path,
$encoding = self::ENCODING_BASE64 )
protected

Encode a file attachment in requested format.

Returns an empty string on failure.

Parameters
string$pathThe full path to the file
string$encodingThe encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
Return values
string

◆ encodeHeader()

PHPMailer\PHPMailer\encodeHeader ( $str,
$position = 'text' )

Encode a header value (not including its label) optimally.

Picks shortest of Q, B, or none. Result includes folding if needed. See RFC822 definitions for phrase, comment and text positions.

Parameters
string$strThe header value to encode
string$positionWhat context the string will be used in
Return values
string

◆ encodeQ()

PHPMailer\PHPMailer\encodeQ ( $str,
$position = 'text' )

Encode a string using Q encoding.

See also
http://tools.ietf.org/html/rfc2047#section-4.2
Parameters
string$strthe text to encode
string$positionWhere the text is going to be used, see the RFC for what that means
Return values
string

◆ encodeQP()

PHPMailer\PHPMailer\encodeQP ( $string)

Encode a string in quoted-printable format.

According to RFC2045 section 6.7.

Parameters
string$stringThe text to encode
Return values
string

◆ encodeString()

PHPMailer\PHPMailer\encodeString ( $str,
$encoding = self::ENCODING_BASE64 )

Encode a string in requested format.

Returns an empty string on failure.

Parameters
string$strThe text to encode
string$encodingThe encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
Exceptions
Exception
Return values
string

◆ endBoundary()

PHPMailer\PHPMailer\endBoundary ( $boundary)
protected

Return the end of a message boundary.

Parameters
string$boundary
Return values
string

◆ filenameToType()

static PHPMailer\PHPMailer\filenameToType ( $filename)
static

Map a file name to a MIME type.

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

Parameters
string$filenameA file name or full path, does not need to exist as a file
Return values
string

◆ generateId()

PHPMailer\PHPMailer\generateId ( )
protected

Create a unique ID to use for boundaries.

Return values
string

◆ getAllRecipientAddresses()

PHPMailer\PHPMailer\getAllRecipientAddresses ( )

Allows for public read access to 'all_recipients' property.

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

Return values
array

◆ getAttachments()

PHPMailer\PHPMailer\getAttachments ( )

Return the array of attachments.

Return values
array

◆ getBccAddresses()

PHPMailer\PHPMailer\getBccAddresses ( )

Allows for public read access to 'bcc' property.

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

Return values
array

◆ getBoundaries()

PHPMailer\PHPMailer\getBoundaries ( )

Get the boundaries that this message will use.

Return values
array

◆ getBoundary()

PHPMailer\PHPMailer\getBoundary ( $boundary,
$charSet,
$contentType,
$encoding )
protected

Return the start of a message boundary.

Parameters
string$boundary
string$charSet
string$contentType
string$encoding
Return values
string

◆ getCcAddresses()

PHPMailer\PHPMailer\getCcAddresses ( )

Allows for public read access to 'cc' property.

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

Return values
array

◆ getCustomHeaders()

PHPMailer\PHPMailer\getCustomHeaders ( )

Returns all custom headers.

Return values
array

◆ getLE()

static PHPMailer\PHPMailer\getLE ( )
static

Return the current line break format string.

Return values
string

◆ getMailMIME()

PHPMailer\PHPMailer\getMailMIME ( )

Get the message MIME type headers.

Return values
string

◆ getOAuth()

PHPMailer\PHPMailer\getOAuth ( )

Get the OAuthTokenProvider instance.

Return values
OAuthTokenProvider

◆ getReplyToAddresses()

PHPMailer\PHPMailer\getReplyToAddresses ( )

Allows for public read access to 'ReplyTo' property.

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

Return values
array

◆ getSentMIMEMessage()

PHPMailer\PHPMailer\getSentMIMEMessage ( )

Returns the whole MIME message.

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

See also
PHPMailer\preSend()
Return values
string

◆ getToAddresses()

PHPMailer\PHPMailer\getToAddresses ( )

Allows for public read access to 'to' property.

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

Return values
array

◆ getTranslations()

PHPMailer\PHPMailer\getTranslations ( )

Get the array of strings for the current language.

Return values
array

◆ has8bitChars()

PHPMailer\PHPMailer\has8bitChars ( $text)

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

Parameters
string$text
Return values
bool

◆ hasLineLongerThanMax()

static PHPMailer\PHPMailer\hasLineLongerThanMax ( $str)
static

Detect if a string contains a line longer than the maximum line length allowed by RFC 2822 section 2.1.1.

Parameters
string$str
Return values
bool

◆ hasMultiBytes()

PHPMailer\PHPMailer\hasMultiBytes ( $str)

Check if a string contains multi-byte characters.

Parameters
string$strmulti-byte text to wrap encode
Return values
bool

◆ headerLine()

PHPMailer\PHPMailer\headerLine ( $name,
$value )

Format a header line.

Parameters
string$name
string | int$value
Return values
string

◆ html2text()

PHPMailer\PHPMailer\html2text ( $html,
$advanced = false )

Convert an HTML string into plain text.

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();
});
Parameters
string$htmlThe HTML text to convert
bool | callable$advancedAny boolean value to use the internal converter, or provide your own callable for custom conversion. Never pass user-supplied data into this parameter
Return values
string

◆ inlineImageExists()

PHPMailer\PHPMailer\inlineImageExists ( )

Check if an inline attachment is present.

Return values
bool

◆ isError()

PHPMailer\PHPMailer\isError ( )

Check if an error occurred.

Return values
boolTrue if an error did occur

◆ isValidHost()

static PHPMailer\PHPMailer\isValidHost ( $host)
static

Validate whether a string contains a valid value to use as a hostname or IP address.

IPv6 addresses must include [], e.g. [::1], not just ::1.

Parameters
string$hostThe host name or IP address to check
Return values
bool

◆ lang()

PHPMailer\PHPMailer\lang ( $key)
protected

Get an error message in the current language.

Parameters
string$key
Return values
string

◆ mb_pathinfo()

static PHPMailer\PHPMailer\mb_pathinfo ( $path,
$options = null )
static

Multi-byte-safe pathinfo replacement.

Drop-in replacement for pathinfo(), but multibyte- and cross-platform-safe.

See also
http://www.php.net/manual/en/function.pathinfo.php#107461
Parameters
string$pathA filename or path, does not need to exist as a file
int | string$optionsEither a PATHINFO_* constant, or a string name to return only the specified piece
Return values
string|array

◆ msgHTML()

PHPMailer\PHPMailer\msgHTML ( $message,
$basedir = '',
$advanced = false )

Create a message body from an HTML 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.

Parameters
string$messageHTML message string
string$basedirAbsolute path to a base directory to prepend to relative paths to images
bool | callable$advancedWhether to use the internal HTML to text converter or your own custom converter
Return values
stringThe transformed message body
Exceptions
Exception
See also
PHPMailer\html2text()

◆ normalizeBreaks()

static PHPMailer\PHPMailer\normalizeBreaks ( $text,
$breaktype = null )
static

Normalize line breaks in a 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
string$text
string$breaktypeWhat kind of line break to use; defaults to static\$LE
Return values
string

◆ quotedString()

static PHPMailer\PHPMailer\quotedString ( $str)
static

If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash.

Parameters
string$str
Return values
string
See also
RFC822 3.4.1

◆ rfcDate()

static PHPMailer\PHPMailer\rfcDate ( )
static

Return an RFC 822 formatted date.

Return values
string

◆ secureHeader()

PHPMailer\PHPMailer\secureHeader ( $str)

Strip newlines to prevent header injection.

Parameters
string$str
Return values
string

◆ serverHostname()

PHPMailer\PHPMailer\serverHostname ( )
protected

Get the server hostname.

Returns 'localhost.localdomain' if unknown.

Return values
string

◆ set()

PHPMailer\PHPMailer\set ( $name,
$value = '' )

Set or reset instance properties.

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;`.

Parameters
string$nameThe property name to set
mixed$valueThe value to set the property to
Return values
bool

◆ setError()

PHPMailer\PHPMailer\setError ( $msg)
protected

Add an error message to the error container.

Parameters
string$msg

◆ setLE()

static PHPMailer\PHPMailer\setLE ( $le)
staticprotected

Set the line break format string, e.g.

"::r::n".

Parameters
string$le

◆ setMessageType()

PHPMailer\PHPMailer\setMessageType ( )
protected

Set the message type.

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

◆ setWordWrap()

PHPMailer\PHPMailer\setWordWrap ( )

Apply word wrapping to the message body.

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

PHPMailer\PHPMailer\sign ( $cert_filename,
$key_filename,
$key_pass,
$extracerts_filename = '' )

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

Parameters
string$cert_filename
string$key_filename
string$key_passPassword for private key
string$extracerts_filenameOptional path to chain certificate

◆ stripTrailingBreaks()

static PHPMailer\PHPMailer\stripTrailingBreaks ( $text)
static

Strip trailing line breaks from a string.

Parameters
string$text
Return values
stringThe text to remove breaks from

◆ stripTrailingWSP()

static PHPMailer\PHPMailer\stripTrailingWSP ( $text)
static

Remove trailing whitespace from a string.

Parameters
string$text
Return values
stringThe text to remove whitespace from

◆ textLine()

PHPMailer\PHPMailer\textLine ( $value)

Return a formatted mail line.

Parameters
string$value
Return values
string

◆ utf8CharBoundary()

PHPMailer\PHPMailer\utf8CharBoundary ( $encodedText,
$maxLength )

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

Original written by Colin Brown.

Parameters
string$encodedTextutf-8 QP text
int$maxLengthFind the last character boundary prior to this length
Return values
int

◆ validateEncoding()

PHPMailer\PHPMailer\validateEncoding ( $encoding)
protected

Validate encodings.

Parameters
string$encoding
Return values
bool

◆ wrapText()

PHPMailer\PHPMailer\wrapText ( $message,
$length,
$qp_mode = false )

Word-wrap message.

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

Parameters
string$messageThe message to wrap
int$lengthThe line length to wrap to
bool$qp_modeWhether to run in Quoted-Printable mode
Return values
string