core/model/modx/mail/phpmailer/class.phpmailer.php

Show: inherited
Table of Contents

\PHPMailer

Package:

Properties

Propertypublicstring  $AltBody= ''''

Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.

Default value''Details
Type
string
Propertypublicstring  $Body= ''''

Sets the Body of the message. This can be either an HTML or text body.

If HTML then run IsHTML(true).

Default value''Details
Type
string
Propertypublicstring  $CharSet= ''iso-8859-1''

Sets the CharSet of the message.

Default value'iso-8859-1'Details
Type
string
Propertypublicstring  $ConfirmReadingTo= ''''

Sets the email address that a reading confirmation will be sent.

Default value''Details
Type
string
Propertypublicstring  $ContentType= ''text/plain''

Sets the Content-type of the message.

Default value'text/plain'Details
Type
string
Propertypublic  $CustomHeader= 'array()'
Default valuearray()Details
Type
n/a
Propertypublicstring  $Encoding= ''8bit''

Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".

Default value'8bit'Details
Type
string
Propertypublicstring  $ErrorInfo= ''''

Holds the most recent mailer error message.

Default value''Details
Type
string
Propertypublicstring  $From= ''root@localhost''

Sets the From email address for the message.

Default value'root@localhost'Details
Type
string
Propertypublicstring  $FromName= ''Root User''

Sets the From name of the message.

Default value'Root User'Details
Type
string
Propertypublicstring  $Helo= ''''

Sets the SMTP HELO of the message (Default is $Hostname).

Default value''Details
Type
string
Propertypublicstring  $Host= ''localhost''

Sets the SMTP hosts. All hosts must be separated by a semicolon. 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").

Hosts will be tried in order.

Default value'localhost'Details
Type
string
Propertypublicstring  $Hostname= ''''

Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.

Default value''Details
Type
string
Propertypublic  $LE= '"\n"'
Default value"\n"Details
Type
n/a
Propertypublicstring  $Mailer= ''mail''

Method to send mail: ("mail", "sendmail", or "smtp").

Default value'mail'Details
Type
string
Propertypublicstring  $MessageID= ''''

Sets the message ID to be used in the Message-Id header.

If empty, a unique id will be generated.

Default value''Details
Type
string
Propertypublicstring  $Password= ''''

Sets SMTP password.

Default value''Details
Type
string
Propertypublicstring  $PluginDir= ''''

Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.

Default value''Details
Type
string
Propertypublicint  $Port= '25'

Sets the default SMTP server port.

Default value25Details
Type
int
Propertypublicint  $Priority= '3'

Email priority (1 = High, 3 = Normal, 5 = low).

Default value3Details
Type
int
Propertypublic  $ReplyTo= 'array()'
Default valuearray()Details
Type
n/a
Propertypublicbool  $SMTPAuth= 'false'

Sets SMTP authentication. Utilizes the Username and Password variables.

Default valuefalseDetails
Type
bool
Propertypublicbool  $SMTPDebug= 'false'

Sets SMTP class debugging on or off.

Default valuefalseDetails
Type
bool
Propertypublicbool  $SMTPKeepAlive= 'false'

Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().

Default valuefalseDetails
Type
bool
Propertypublicstring  $SMTPSecure= '""'

Sets connection prefix.

Options are "", "ssl" or "tls"

Default value""Details
Type
string
Propertypublicstring  $Sender= ''''

Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.

Default value''Details
Type
string
Propertypublicstring  $Sendmail= ''/usr/sbin/sendmail''

Sets the path of the sendmail program.

Default value'/usr/sbin/sendmail'Details
Type
string
Propertypublicbool  $SingleTo= 'false'

Provides the ability to have the TO field process individual emails, instead of sending to entire TO addresses

Default valuefalseDetails
Type
bool
Propertypublicstring  $Subject= ''''

Sets the Subject of the message.

Default value''Details
Type
string
Propertypublicint  $Timeout= '10'

Sets the SMTP server timeout in seconds. This function will not work with the win32 version.

Default value10Details
Type
int
Propertypublicstring  $Username= ''''

Sets SMTP username.

Default value''Details
Type
string
Propertypublicstring  $Version= '"2.0.4"'

Holds PHPMailer version.

Default value"2.0.4"Details
Type
string
Propertypublicint  $WordWrap= '0'

Sets word wrapping on the body of the message to a given number of characters.

Default value0Details
Type
int
Propertypublic  $attachment= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $bcc= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $boundary= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $cc= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $error_count= '0'
Default value0Details
Type
n/a
Propertypublic  $language= 'array()'
Default valuearray()Details
Type
n/a
Propertypublic  $message_type= ''''
Default value''Details
Type
n/a
Propertypublic  $sign_cert_file= '""'
Default value""Details
Type
n/a
Propertypublic  $sign_key_file= '""'
Default value""Details
Type
n/a
Propertypublic  $sign_key_pass= '""'
Default value""Details
Type
n/a
Propertypublic  $smtp= 'NULL'
Default valueNULLDetails
Type
n/a
Propertypublic  $to= 'array()'
Default valuearray()Details
Type
n/a

Methods

methodpublicAddAddress( string $address, string $name = '' ) : void

Adds a "To" address.

Parameters
Name Type Description
$address string
$name string
methodpublicAddAttachment( string $path, string $name = '', string $encoding = 'base64', string $type = 'application/octet-stream' ) : bool

Adds an attachment from a path on the filesystem.

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

Parameters
Name Type Description
$path string

Path to the attachment.

$name string

Overrides the attachment name.

$encoding string

File encoding (see $Encoding).

$type string

File extension (MIME) type.

Returns
Type Description
bool
methodpublicAddBCC( string $address, string $name = '' ) : void

Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.

Parameters
Name Type Description
$address string
$name string
methodpublicAddCC( string $address, string $name = '' ) : void

Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.

Parameters
Name Type Description
$address string
$name string
methodpublicAddCustomHeader(  $custom_header ) : void

Adds a custom header.

Parameters
Name Type Description
$custom_header
methodpublicAddEmbeddedImage( string $path, string $cid, string $name = '', string $encoding = 'base64', string $type = 'application/octet-stream' ) : bool

Adds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".

Parameters
Name Type Description
$path string

Path to the attachment.

$cid string

Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form.

$name string

Overrides the attachment name.

$encoding string

File encoding (see $Encoding).

$type string

File extension (MIME) type.

Returns
Type Description
bool
methodpublicAddReplyTo( string $address, string $name = '' ) : void

Adds a "Reply-To" address.

Parameters
Name Type Description
$address string
$name string
methodpublicAddStringAttachment( string $string, string $filename, string $encoding = 'base64', string $type = 'application/octet-stream' ) : void

Adds a string or binary attachment (non-filesystem) to the list.

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

Parameters
Name Type Description
$string string

String attachment data.

$filename string

Name of the attachment.

$encoding string

File encoding (see $Encoding).

$type string

File extension (MIME) type.

methodpublicAddrAppend(  $type,  $addr ) : string

Creates recipient headers.

Parameters
Name Type Description
$type
$addr
Returns
Type Description
string
Details
Access
private  
methodpublicAddrFormat(  $addr ) : string

Formats an address correctly.

Parameters
Name Type Description
$addr
Returns
Type Description
string
Details
Access
private  
methodpublicAttachAll( ) : string

Attaches all fs, string, and binary attachments to the message.

Returns an empty string on failure.

Returns
Type Description
string
Details
Access
private  
methodpublicBase64EncodeWrapMB( string $str ) : string

Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.

Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php

Parameters
Name Type Description
$str string

multi-byte text to wrap encode

Returns
Type Description
string
Details
Access
private  
methodpublicClearAddresses( ) : void

Clears all recipients assigned in the TO array. Returns void.

methodpublicClearAllRecipients( ) : void

Clears all recipients assigned in the TO, CC and BCC array. Returns void.

methodpublicClearAttachments( ) : void

Clears all previously set filesystem, string, and binary attachments. Returns void.

methodpublicClearBCCs( ) : void

Clears all recipients assigned in the BCC array. Returns void.

methodpublicClearCCs( ) : void

Clears all recipients assigned in the CC array. Returns void.

methodpublicClearCustomHeaders( ) : void

Clears all custom headers. Returns void.

methodpublicClearReplyTos( ) : void

Clears all recipients assigned in the ReplyTo array. Returns void.

methodpublicCreateBody( ) : string

Assembles the message body. Returns an empty string on failure.

Returns
Type Description
string
Details
Access
private  
methodpublicCreateHeader( ) : string

Assembles message header.

Returns
Type Description
string
Details
Access
private  
methodpublicEncodeFile(  $path,  $encoding = 'base64' ) : string

Encodes attachment in requested format. Returns an empty string on failure.

Parameters
Name Type Description
$path
$encoding
Returns
Type Description
string
Details
Access
private  
methodpublicEncodeHeader(  $str,  $position = 'text' ) : string

Encode a header string to best of Q, B, quoted or none.

Parameters
Name Type Description
$str
$position
Returns
Type Description
string
Details
Access
private  
methodpublicEncodeQ(  $str,  $position = 'text' ) : string

Encode string to q encoding.

Parameters
Name Type Description
$str
$position
Returns
Type Description
string
Details
Access
private  
methodpublicEncodeQP(  $input = '',  $line_max = 76,  $space_conv = false ) : string

Encode string to quoted-printable.

Parameters
Name Type Description
$input
$line_max
$space_conv
Returns
Type Description
string
Details
Access
private  
methodpublicEncodeString(  $str,  $encoding = 'base64' ) : string

Encodes string to requested format. Returns an empty string on failure.

Parameters
Name Type Description
$str
$encoding
Returns
Type Description
string
Details
Access
private  
methodpublicEndBoundary(  $boundary ) : void

Returns the end of a message boundary.

Parameters
Name Type Description
$boundary
Details
Access
private  
methodpublicFixEOL(  $str ) : string

Changes every end of line from CR or LF to CRLF.

Parameters
Name Type Description
$str
Returns
Type Description
string
Details
Access
private  
methodpublicGetBoundary(  $boundary,  $charSet,  $contentType,  $encoding ) : void

Returns the start of a message boundary.

Parameters
Name Type Description
$boundary
$charSet
$contentType
$encoding
Details
Access
private  
methodpublicGetMailMIME( ) : string

Returns the message MIME.

Returns
Type Description
string
Details
Access
private  
methodpublicHasMultiBytes( string $str ) : bool

Checks if a string contains multibyte characters.

Parameters
Name Type Description
$str string

multi-byte text to wrap encode

Returns
Type Description
bool
Details
Access
private  
methodpublicHeaderLine(  $name,  $value ) : void

Parameters
Name Type Description
$name
$value
methodpublicInlineImageExists( ) : bool

Returns true if an inline attachment is present.

Returns
Type Description
bool
Details
Access
private  
methodpublicIsError( ) : bool

Returns true if an error occurred.

Returns
Type Description
bool
methodpublicIsHTML( bool $bool ) : void

Sets message type to HTML.

Parameters
Name Type Description
$bool bool
methodpublicIsMail( ) : void

Sets Mailer to send message using PHP mail() function.

methodpublicIsQmail( ) : void

Sets Mailer to send message using the qmail MTA.

methodpublicIsSMTP( ) : void

Sets Mailer to send message using SMTP.

methodpublicIsSendmail( ) : void

Sets Mailer to send message using the $Sendmail program.

methodpublicLang(  $key ) : string

Returns a message in the appropriate language.

Parameters
Name Type Description
$key
Returns
Type Description
string
Details
Access
private  
methodpublicMailSend(  $header,  $body ) : bool

Sends mail using the PHP mail() function.

Parameters
Name Type Description
$header
$body
Returns
Type Description
bool
Details
Access
private  
methodpublicMsgHTML(  $message,  $basedir = '' ) : \$message

Evaluates the message and returns modifications for inline images and backgrounds

Parameters
Name Type Description
$message
$basedir
Returns
Type Description
\$message
Details
Access
public  
methodpublicRFCDate( ) : string

Returns the proper RFC 822 formatted date.

Returns
Type Description
string
Details
Access
private  
methodpublicSecureHeader( string $str ) : string

Strips newlines to prevent header injection.

Parameters
Name Type Description
$str string

String

Returns
Type Description
string
Details
Access
private  
methodpublicSend( ) : bool

Creates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.

Returns
Type Description
bool
methodpublicSendmailSend(  $header,  $body ) : bool

Sends mail using the $Sendmail program.

Parameters
Name Type Description
$header
$body
Returns
Type Description
bool
Details
Access
private  
methodpublicServerHostname( ) : string

Returns the server hostname or 'localhost.localdomain' if unknown.

Returns
Type Description
string
Details
Access
private  
methodpublicServerVar(  $varName ) : mixed

Returns the appropriate server variable. Should work with both PHP 4.1.0+ as well as older versions. Returns an empty string if nothing is found.

Parameters
Name Type Description
$varName
Returns
Type Description
mixed
Details
Access
private  
methodpublicSetError(  $msg ) : void

Adds the error message to the error container.

Returns void.

Parameters
Name Type Description
$msg
Details
Access
private  
methodpublicSetLanguage( string $lang_type, string $lang_path = 'language/' ) : bool

Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.

Parameters
Name Type Description
$lang_type string

Type of language (e.g. Portuguese: "br")

$lang_path string

Path to the language file directory

Returns
Type Description
bool
Details
Access
public  
methodpublicSetMessageType( ) : void

Sets the message type.

Details
Access
private  
methodpublicSetWordWrap( ) : void

Set the body wrapping.

Details
Access
private  
methodpublicSign(  $cert_filename, string $key_filename, string $key_pass ) : void

Set the private key file and password to sign the message.

Parameters
Name Type Description
$cert_filename
$key_filename string

Parameter File Name

$key_pass string

Password for private key

Details
Access
public  
methodpublicSmtpClose( ) : void

Closes the active SMTP session if one exists.

methodpublicSmtpConnect( ) : bool

Initiates a connection to an SMTP server. Returns false if the operation failed.

Returns
Type Description
bool
Details
Access
private  
methodpublicSmtpSend(  $header,  $body ) : bool

Sends mail via SMTP using PhpSMTP (Author: Chris Ryan). Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.

Parameters
Name Type Description
$header
$body
Returns
Type Description
bool
Details
Access
private  
methodpublicTextLine(  $value ) : string

Returns a formatted mail line.

Parameters
Name Type Description
$value
Returns
Type Description
string
Details
Access
private  
methodpublicUTF8CharBoundary( string $encodedText, int $maxLength ) : int

Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.

Original written by Colin Brown.

Parameters
Name Type Description
$encodedText string

utf-8 QP text

$maxLength int

find last character boundary prior to this length

Returns
Type Description
int
Details
Access
private  
methodpublicWrapText(  $message,  $length,  $qp_mode = false ) : string

Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.

Original written by philippe.

Parameters
Name Type Description
$message
$length
$qp_mode
Returns
Type Description
string
Details
Access
private  
methodpublic_mime_types(  $ext = '' ) : \mime

Gets the mime type of the embedded or inline image

Parameters
Name Type Description
$ext
Returns
Type Description
\mime type of ext
Details
Access
private  
methodpublicgetFile( string $filename ) : void

Read a file from a supplied filename and return it.

Parameters
Name Type Description
$filename string

Parameter File Name

Details
Access
public  
methodpublicset( string $name, mixed $value = '' ) : void

Set (or reset) Class Objects (variables)

Usage Example: $page->set('X-Priority', '3');

Parameters
Name Type Description
$name string

Parameter Name

$value mixed

Parameter Value NOTE: will not work with arrays, there are no arrays to set/reset

Details
Access
public  
Documentation was generated by DocBlox 0.18.1.