Class PHPMailer

Description

PHPMailer - PHP email creation and transport class.

Located in /class.phpmailer.php (line 28)


	
			
Class Constant Summary
Variable Summary
mixed $AllowEmpty
mixed $AltBody
mixed $attachment
mixed $AuthType
mixed $bcc
mixed $Body
mixed $boundary
mixed $cc
mixed $CharSet
mixed $ContentType
mixed $Debugoutput
mixed $DKIM_domain
mixed $do_verp
mixed $Encoding
mixed $ErrorInfo
mixed $error_count
mixed $exceptions
mixed $From
mixed $FromName
mixed $Helo
mixed $Host
mixed $Hostname
mixed $Ical
mixed $language
mixed $LE
mixed $Mailer
mixed $mailHeader
mixed $MessageDate
mixed $MessageID
mixed $MIMEBody
mixed $MIMEHeader
mixed $Password
mixed $PluginDir
mixed $Port
mixed $Priority
mixed $Realm
mixed $ReplyTo
mixed $ReturnPath
mixed $Sender
mixed $Sendmail
mixed $SingleTo
mixed $smtp
mixed $SMTPAuth
mixed $SMTPDebug
mixed $SMTPSecure
mixed $Subject
mixed $Timeout
mixed $to
mixed $Username
mixed $Version
mixed $WordWrap
mixed $Workstation
mixed $XMailer
Method Summary
static string filenameToType (string $filename)
static string|array mb_pathinfo (string $path, [integer|string $options = null])
static string normalizeBreaks (string $text, [string $breaktype = "\r\n"])
static string rfcDate ()
static bool validateAddress (string $address, [string $patternselect = 'auto'])
static string _mime_types ([string $ext = ''])
PHPMailer __construct ([bool $exceptions = false])
void __destruct ()
bool addAddress (string $address, [string $name = ''])
bool addAnAddress (string $kind, string $address, [string $name = ''])
bool addAttachment (string $path, [string $name = ''], [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'attachment'])
bool addBCC (string $address, [string $name = ''])
bool addCC (string $address, [string $name = ''])
void addCustomHeader (string $name, [string $value = null])
bool addEmbeddedImage (string $path, string $cid, [string $name = ''], [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'inline'])
string addrAppend (string $type, array $addr)
bool addReplyTo (string $address, [string $name = ''])
string addrFormat (array $addr)
void addStringAttachment (string $string, string $filename, [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'attachment'])
bool addStringEmbeddedImage (string $string, string $cid, [string $name = ''], [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'inline'])
string attachAll (string $disposition_type, string $boundary)
string base64EncodeWrapMB (string $str, [string $linebreak = null])
void clearAddresses ()
void clearBCCs ()
void clearCCs ()
void clearReplyTos ()
string createBody ()
string createHeader ()
string DKIM_Add (string $headers_line, string $subject, string $body)
string DKIM_BodyC (string $body)
string DKIM_HeaderC (string $signheader)
string DKIM_QP (string $txt)
string DKIM_Sign (string $signheader)
void doCallback (bool $isSent, string $to, string $cc, string $bcc, string $subject, string $body, [string $from = null])
void edebug (string $str)
string encodeFile (string $path, [string $encoding = 'base64'])
string encodeHeader (string $str, [string $position = 'text'])
string encodeQ (string $str, [string $position = 'text'])
string encodeQP (string $string, [integer $line_max = 76])
string encodeQPphp (string $string, [integer $line_max = 76], [bool $space_conv = false])
string encodeString (string $str, [string $encoding = 'base64'])
string endBoundary (string $boundary)
string fixEOL (string $str)
array getAttachments ()
array getBccAddresses ()
string getBoundary (string $boundary, string $charSet, string $contentType, string $encoding)
array getCcAddresses ()
string getLastMessageID ()
string getMailMIME ()
string getSentMIMEMessage ()
array getToAddresses ()
array getTranslations ()
bool has8bitChars (string $text)
bool hasMultiBytes (string $str)
string headerLine (string $name, string $value)
string html2text (string $html, [bool $advanced = false])
bool isError ()
void isHTML ([bool $ishtml = true])
void isMail ()
void isQmail ()
void isSendmail ()
void isSMTP ()
string lang (string $key)
bool mailSend (string $header, string $body)
string msgHTML (string $message, [string $basedir = ''], [bool $advanced = false])
bool postSend ()
bool preSend ()
string secureHeader (string $str)
bool send ()
bool sendmailSend (string $header, string $body)
string serverHostname ()
bool set (string $name, [mixed $value = ''])
void setError (string $msg)
bool setFrom (string $address, [string $name = ''], [bool $auto = true])
bool setLanguage ([string $langcode = 'en'], [string $lang_path = ''])
void setMessageType ()
void setWordWrap ()
void sign (string $cert_filename, string $key_filename, string $key_pass)
void smtpClose ()
bool smtpConnect ([array $options = array()])
bool smtpSend (string $header, string $body)
string textLine (string $value)
int utf8CharBoundary (string $encodedText, int $maxLength)
string wrapText (string $message, integer $length, [bool $qp_mode = false])
Variables
mixed $action_function = '' (line 414)

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 string $to email address of the recipient string $cc cc email addresses string $bcc bcc email addresses string $subject the subject string $body the email body string $from email address of sender

  • access: public
mixed $AllowEmpty = false (line 353)

Whether to allow sending messages with an empty body.

  • access: public
mixed $all_recipients = array() (line 464)

An array of all kinds of addresses.

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

  • access: protected
mixed $AltBody = '' (line 117)

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.

  • access: public
mixed $attachment = array() (line 471)

The array of attachments.

  • access: protected
mixed $AuthType = '' (line 272)

SMTP auth type.

Options are LOGIN (default), PLAIN, NTLM, CRAM-MD5

  • access: public
mixed $bcc = array() (line 449)

The array of 'bcc' addresses.

  • access: protected
mixed $Body = '' (line 108)

An HTML or plain text message body.

If HTML then call isHTML(true).

  • access: public
mixed $boundary = array() (line 499)

The array of MIME boundary strings.

  • access: protected
mixed $cc = array() (line 442)

The array of 'cc' addresses.

  • access: protected
mixed $CharSet = 'iso-8859-1' (line 47)

The character set of the message.

  • access: public
mixed $ConfirmReadingTo = '' (line 188)

The email address that a reading confirmation should be sent to.

  • access: public
mixed $ContentType = 'text/plain' (line 53)

The MIME Content-type of the message.

  • access: public
mixed $CustomHeader = array() (line 478)

The array of custom headers.

  • access: protected
mixed $Debugoutput = 'echo' (line 316)

How to handle debug output.

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

mixed $DKIM_domain = '' (line 388)

DKIM signing domain name.

  • access: public
  • example: example not found
mixed $DKIM_identity = '' (line 374)

DKIM Identity.

Usually the email address used as the source of the email

  • access: public
mixed $DKIM_passphrase = '' (line 381)

DKIM passphrase.

Used if your key is encrypted.

  • access: public
mixed $DKIM_private = '' (line 394)

DKIM private key file path.

  • access: public
mixed $DKIM_selector = '' (line 367)

DKIM selector.

  • access: public
mixed $do_verp = false (line 347)

Whether to generate VERP addresses on send.

Only applicable when sending via SMTP.

mixed $Encoding = '8bit' (line 60)

The message encoding.

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

  • access: public
mixed $ErrorInfo = '' (line 66)

Holds the most recent mailer error message.

  • access: public
mixed $error_count = 0 (line 513)

The number of errors encountered.

  • access: protected
mixed $exceptions = false (line 542)

Whether to throw exceptions for errors.

  • access: protected
mixed $From = 'root@localhost' (line 72)

The From email address for the message.

  • access: public
mixed $FromName = 'Root User' (line 78)

The From name of the message.

  • access: public
mixed $Helo = '' (line 237)

The SMTP HELO of the message.

Default is $Hostname.

mixed $Host = 'localhost' (line 222)

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"). Hosts will be tried in order.

  • access: public
mixed $Hostname = '' (line 197)

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

  • access: public
mixed $Ical = '' (line 127)

An iCal message part body.

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

mixed $language = array() (line 506)

The array of available languages.

  • access: protected
mixed $lastMessageID = '' (line 485)

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

  • access: protected
mixed $LE = "\n" (line 361)

The default line ending.

  • access: public
mixed $Mailer = 'mail' (line 161)

Which method to use to send mail.

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

  • access: public
mixed $mailHeader = '' (line 148)

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

  • access: protected
mixed $MessageDate = '' (line 211)

The message Date to be used in the Date header.

If empty, the current date will be added.

  • access: public
mixed $MessageID = '' (line 204)

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

If empty, a unique id will be generated.

  • access: public
mixed $message_type = '' (line 492)

The message's MIME type.

  • access: protected
mixed $MIMEBody = '' (line 134)

The complete compiled MIME message body.

  • access: protected
mixed $MIMEHeader = '' (line 141)

The complete compiled MIME message headers.

  • access: protected
mixed $Password = '' (line 265)

SMTP password.

  • access: public
mixed $PluginDir = '' (line 182)

Path to PHPMailer plugins.

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

  • deprecated: Should not be needed now there is an autoloader.
  • access: public
mixed $Port = 25 (line 229)

The default SMTP server port.

  • access: public
mixed $Priority = 3 (line 41)

Email priority.

Options: 1 = High, 3 = Normal, 5 = low.

  • access: public
mixed $Realm = '' (line 279)

SMTP realm.

Used for NTLM auth

  • access: public
mixed $ReplyTo = array() (line 456)

The array of reply-to names and addresses.

  • access: protected
mixed $ReturnPath = '' (line 95)

The Return-Path of the message.

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

  • link: RFC5321 reference
  • deprecated: Email senders should never set a return-path header; it's the receiver's job (RFC5321 section 4.4), so this no longer does anything.
  • access: public
mixed $Sender = '' (line 85)

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.

  • access: public
mixed $Sendmail = '/usr/sbin/sendmail' (line 167)

The path to the sendmail program.

  • access: public
mixed $sign_cert_file = '' (line 520)

The S/MIME certificate file path.

  • access: protected
mixed $sign_key_file = '' (line 527)

The S/MIME key file path.

  • access: protected
mixed $sign_key_pass = '' (line 535)

The S/MIME password for the key.

Used only if the key is encrypted.

  • access: protected
mixed $SingleTo = false (line 331)

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

  • access: public
mixed $SingleToArray = array() (line 338)

Storage for addresses when SingleTo is enabled.

  • todo: This should really not be public
  • access: public
mixed $smtp = null (line 428)

An instance of the SMTP sender class.

  • access: protected
mixed $SMTPAuth = false (line 253)

Whether to use SMTP authentication.

Uses the Username and Password properties.

mixed $SMTPDebug = 0 (line 305)

SMTP class debug output mode.

Options: 0: no output 1: commands 2: data and commands 3: as 2 plus connection status 4: low level data output

mixed $SMTPKeepAlive = false (line 324)

Whether to keep SMTP connection open after each message.

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

  • access: public
mixed $SMTPSecure = '' (line 244)

The secure connection prefix.

Options: "", "ssl" or "tls"

  • access: public
mixed $Subject = '' (line 101)

The Subject of the message.

  • access: public
mixed $Timeout = 10 (line 292)

The SMTP server timeout in seconds.

  • access: public
mixed $to = array() (line 435)

The array of 'to' addresses.

  • access: protected
mixed $Username = '' (line 259)

SMTP username.

  • access: public
mixed $UseSendmailOptions = true (line 174)

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

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

  • access: public
mixed $Version = '5.2.8' (line 34)

The PHPMailer Version number.

  • access: public
mixed $WordWrap = 0 (line 154)

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

  • access: public
mixed $Workstation = '' (line 286)

SMTP workstation.

Used for NTLM auth

  • access: public
mixed $XMailer = '' (line 421)

What to use in the X-Mailer header.

Options: null for default, whitespace for none, or a string to use

  • access: public
Methods
static method filenameToType (line 3045)

Map a file name to a MIME type.

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

  • access: public
static string filenameToType (string $filename)
  • string $filename: A file name or full path, does not need to exist as a file
static method mb_pathinfo (line 3067)

Multi-byte-safe pathinfo replacement.

Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe. Works similarly to the one in PHP >= 5.2.0

static string|array mb_pathinfo (string $path, [integer|string $options = null])
  • string $path: A filename or path, does not need to exist as a file
  • integer|string $options: Either a PATHINFO_* constant, or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
static method normalizeBreaks (line 3158)

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.

  • access: public
static string normalizeBreaks (string $text, [string $breaktype = "\r\n"])
  • string $text
  • string $breaktype: What kind of line break to use, defaults to CRLF
static method rfcDate (line 2763)

Return an RFC 822 formatted date.

  • access: public
static string rfcDate ()
static method validateAddress (line 856)

Check that a string looks like an email address.

  • access: public
static bool validateAddress (string $address, [string $patternselect = 'auto'])
  • string $address: The email address to check
  • string $patternselect: A selector for the validation pattern to use : * `auto` Pick strictest one automatically; * `pcre8` Use the squiloople.com pattern, requires PCRE > 8.0, PHP >= 5.3.2, 5.2.14; * `pcre` Use old PCRE implementation; * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; same as pcre8 but does not allow 'dotless' domains; * `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.
static method _mime_types (line 2943)

Get the MIME type for a file extension.

  • return: MIME type of file.
  • access: public
static string _mime_types ([string $ext = ''])
  • string $ext: File extension
Constructor __construct (line 568)

Constructor

  • access: public
PHPMailer __construct ([bool $exceptions = false])
  • bool $exceptions: Should we throw external exceptions?
Destructor __destruct (line 583)

Destructor.

  • access: public
void __destruct ()
addAddress (line 715)

Add a "To" address.

  • return: true on success, false if address already used
  • access: public
bool addAddress (string $address, [string $name = ''])
  • string $address
  • string $name
addAnAddress (line 765)

Add an address to one of the recipient arrays.

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

  • return: true on success, false if address already used or invalid in some way
  • throws: phpmailerException
  • access: protected
bool addAnAddress (string $kind, string $address, [string $name = ''])
  • string $kind: One of 'to', 'cc', 'bcc', 'ReplyTo'
  • string $address: The email address to send to
  • string $name
addAttachment (line 2049)

Add an attachment from a path on the filesystem.

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

  • throws: phpmailerException
  • access: public
bool addAttachment (string $path, [string $name = ''], [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'attachment'])
  • string $path: Path to the attachment.
  • string $name: Overrides the attachment name.
  • string $encoding: File encoding (see $Encoding).
  • string $type: File extension (MIME) type.
  • string $disposition: Disposition to use
addBCC (line 739)

Add a "BCC" address.

  • return: true on success, false if address already used
  • access: public
bool addBCC (string $address, [string $name = ''])
  • string $address
  • string $name
addCC (line 727)

Add a "CC" address.

  • return: true on success, false if address already used
  • access: public
bool addCC (string $address, [string $name = ''])
  • string $address
  • string $name
addCustomHeader (line 2848)

Add a custom header.

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

  • access: public
void addCustomHeader (string $name, [string $value = null])
  • string $name: Custom header name
  • string $value: Header value
addEmbeddedImage (line 2554)

Add an embedded (inline) attachment from a file.

This can include images, sounds, and just about any other document type. These differ from 'regular' attachmants 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.

  • return: True on successfully adding an attachment
  • access: public
bool addEmbeddedImage (string $path, string $cid, [string $name = ''], [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'inline'])
  • string $path: Path to the attachment.
  • string $cid: Content ID of the attachment; Use this to reference the content when using an embedded image in HTML.
  • string $name: Overrides the attachment name.
  • string $encoding: File encoding (see $Encoding).
  • string $type: File MIME type.
  • string $disposition: Disposition to use
addrAppend (line 1434)

Create recipient headers.

  • access: public
string addrAppend (string $type, array $addr)
  • string $type
  • array $addr: An array of recipient, where each recipient is a 2-element indexed array with element 0 containing an address and element 1 containing a name, like: array(array('joe@example.com', 'Joe User'), array('zoe@example.com', 'Zoe User'))
addReplyTo (line 750)

Add a "Reply-to" address.

  • access: public
bool addReplyTo (string $address, [string $name = ''])
  • string $address
  • string $name
addrFormat (line 1450)

Format an address for use in a message header.

  • access: public
string addrFormat (array $addr)
  • array $addr: A 2-element indexed array, element 0 containing an address, element 1 containing a name like array('joe@example.com', 'Joe User')
addStringAttachment (line 2514)

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.

  • access: public
void addStringAttachment (string $string, string $filename, [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'attachment'])
  • string $string: String attachment data.
  • string $filename: Name of the attachment.
  • string $encoding: File encoding (see $Encoding).
  • string $type: File extension (MIME) type.
  • string $disposition: Disposition to use
addStringEmbeddedImage (line 2599)

Add an embedded stringified attachment.

This can include images, sounds, and just about any other document type. Be sure to set the $type to an image type for images: JPEG images use 'image/jpeg', GIF uses 'image/gif', PNG uses 'image/png'.

  • return: True on successfully adding an attachment
  • access: public
bool addStringEmbeddedImage (string $string, string $cid, [string $name = ''], [string $encoding = 'base64'], [string $type = ''], [string $disposition = 'inline'])
  • string $string: The attachment binary data.
  • string $cid: Content ID of the attachment; Use this to reference the content when using an embedded image in HTML.
  • string $name
  • string $encoding: File encoding (see $Encoding).
  • string $type: MIME type.
  • string $disposition: Disposition to use
alternativeExists (line 2659)

Check if this message has an alternative body set.

  • access: public
bool alternativeExists ()
attachAll (line 2105)

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

Returns an empty string on failure.

  • access: protected
string attachAll (string $disposition_type, string $boundary)
  • string $disposition_type
  • string $boundary
attachmentExists (line 2645)

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

  • access: public
bool attachmentExists ()
base64EncodeWrapMB (line 2379)

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

Adapted from a function by paravoid

string base64EncodeWrapMB (string $str, [string $linebreak = null])
  • string $str: multi-byte text to wrap encode
  • string $linebreak: string to use as linefeed/end-of-line
clearAddresses (line 2668)

Clear all To recipients.

  • access: public
void clearAddresses ()
clearAllRecipients (line 2713)

Clear all recipient types.

  • access: public
void clearAllRecipients ()
clearAttachments (line 2725)

Clear all filesystem, string, and binary attachments.

  • access: public
void clearAttachments ()
clearBCCs (line 2692)

Clear all BCC recipients.

  • access: public
void clearBCCs ()
clearCCs (line 2680)

Clear all CC recipients.

  • access: public
void clearCCs ()
clearCustomHeaders (line 2734)

Clear all custom headers.

  • access: public
void clearCustomHeaders ()
clearReplyTos (line 2704)

Clear all ReplyTo recipients.

  • access: public
void clearReplyTos ()
createBody (line 1791)

Assemble the message body.

Returns an empty string on failure.

  • return: The assembled message body
  • throws: phpmailerException
  • access: public
string createBody ()
createHeader (line 1622)

Assemble message headers.

  • return: The assembled headers
  • access: public
string createHeader ()
DKIM_Add (line 3274)

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

  • access: public
string DKIM_Add (string $headers_line, string $subject, string $body)
  • string $headers_line: Header lines
  • string $subject: Subject
  • string $body: Body
DKIM_BodyC (line 3251)

Generate a DKIM canonicalization body.

  • access: public
string DKIM_BodyC (string $body)
  • string $body: Message Body
DKIM_HeaderC (line 3231)

Generate a DKIM canonicalization header.

  • access: public
string DKIM_HeaderC (string $signheader)
  • string $signheader: Header
DKIM_QP (line 3184)

Quoted-Printable-encode a DKIM header.

  • access: public
string DKIM_QP (string $txt)
  • string $txt
DKIM_Sign (line 3205)

Generate a DKIM signature.

  • throws: phpmailerException
  • access: public
string DKIM_Sign (string $signheader)
  • string $signheader: Header
doCallback (line 3392)

Perform a callback.

  • access: protected
void doCallback (bool $isSent, string $to, string $cc, string $bcc, string $subject, string $body, [string $from = null])
  • bool $isSent
  • string $to
  • string $cc
  • string $bcc
  • string $subject
  • string $body
  • string $from
edebug (line 626)

Output debugging info via user-defined method.

Only if debug output is enabled.

void edebug (string $str)
  • string $str
encodeFile (line 2213)

Encode a file attachment in requested format.

Returns an empty string on failure.

  • see: EncodeFile(encodeFile
  • throws: phpmailerException
  • access: protected
string encodeFile (string $path, [string $encoding = 'base64'])
  • string $path: The full path to the file
  • string $encoding: The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
encodeHeader (line 2287)

Encode a header string optimally.

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

  • access: public
string encodeHeader (string $str, [string $position = 'text'])
  • string $str
  • string $position
encodeQ (line 2462)

Encode a string using Q encoding.

string encodeQ (string $str, [string $position = 'text'])
  • string $str: the text to encode
  • string $position: Where the text is going to be used, see the RFC for what that means
encodeQP (line 2421)

Encode a string in quoted-printable format.

According to RFC2045 section 6.7.

string encodeQP (string $string, [integer $line_max = 76])
  • string $string: The text to encode
  • integer $line_max: Number of chars allowed on a line before wrapping
encodeQPphp (line 2446)

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

string encodeQPphp (string $string, [integer $line_max = 76], [bool $space_conv = false])
  • string $string
  • integer $line_max
  • bool $space_conv
encodeString (line 2251)

Encode a string in requested format.

Returns an empty string on failure.

  • access: public
string encodeString (string $str, [string $encoding = 'base64'])
  • string $str: The text to encode
  • string $encoding: The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'
endBoundary (line 1985)

Return the end of a message boundary.

  • access: protected
string endBoundary (string $boundary)
  • string $boundary
fixEOL (line 2828)

Ensure consistent line endings in a string.

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

  • access: public
string fixEOL (string $str)
  • string $str: String to fixEOL
getAllRecipientAddresses (line 3377)

Allows for public read access to 'all_recipients' property.

  • access: public
array getAllRecipientAddresses ()
getAttachments (line 2092)

Return the array of attachments.

  • access: public
array getAttachments ()
getBccAddresses (line 3357)

Allows for public read access to 'bcc' property.

  • access: public
array getBccAddresses ()
getBoundary (line 1955)

Return the start of a message boundary.

  • access: protected
string getBoundary (string $boundary, string $charSet, string $contentType, string $encoding)
  • string $boundary
  • string $charSet
  • string $contentType
  • string $encoding
getCcAddresses (line 3347)

Allows for public read access to 'cc' property.

  • access: public
array getCcAddresses ()
getLastMessageID (line 837)

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.

  • access: public
string getLastMessageID ()
getMailMIME (line 1723)

Get the message MIME type headers.

  • access: public
string getMailMIME ()
getReplyToAddresses (line 3367)

Allows for public read access to 'ReplyTo' property.

  • access: public
array getReplyToAddresses ()
getSentMIMEMessage (line 1778)

Returns the whole MIME message.

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

string getSentMIMEMessage ()
getSMTPInstance (line 1170)

Get an instance to use for SMTP operations.

Override this function to load your own SMTP implementation

  • access: public
SMTP getSMTPInstance ()
getToAddresses (line 3337)

Allows for public read access to 'to' property.

  • access: public
array getToAddresses ()
getTranslations (line 1419)

Get the array of strings for the current language.

  • access: public
array getTranslations ()
has8bitChars (line 2364)

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

  • access: public
bool has8bitChars (string $text)
  • string $text
hasMultiBytes (line 2350)

Check if a string contains multi-byte characters.

  • access: public
bool hasMultiBytes (string $str)
  • string $str: multi-byte text to wrap encode
headerLine (line 2022)

Format a header line.

  • access: public
string headerLine (string $name, string $value)
  • string $name
  • string $value
html2text (line 2922)

Convert an HTML string into plain text.

  • access: public
string html2text (string $html, [bool $advanced = false])
  • string $html: The HTML text to convert
  • bool $advanced: Should this use the more complex html2text converter or just a simple one?
inlineImageExists (line 2631)

Check if an inline attachment is present.

  • access: public
bool inlineImageExists ()
isError (line 2816)

Check if an error occurred.

  • return: True if an error did occur.
  • access: public
bool isError ()
isHTML (line 650)

Sets message type to HTML or plain.

  • access: public
void isHTML ([bool $ishtml = true])
  • bool $ishtml: True for HTML mode.
isMail (line 672)

Send messages using PHP's mail() function.

  • access: public
void isMail ()
isQmail (line 697)

Send messages using qmail.

  • access: public
void isQmail ()
isSendmail (line 681)

Send messages using $Sendmail.

  • access: public
void isSendmail ()
isSMTP (line 663)

Send messages using SMTP.

  • access: public
void isSMTP ()
lang (line 2798)

Get an error message in the current language.

  • access: protected
string lang (string $key)
  • string $key
mailSend (line 1125)

Send mail using the PHP mail() function.

bool mailSend (string $header, string $body)
  • string $header: The message headers
  • string $body: The message body
msgHTML (line 2869)

Create a message from an HTML string.

Automatically makes modifications for inline images and backgrounds and creates a plain-text version by converting the HTML. Overwrites any existing values in $this->Body and $this->AltBody

  • access: public
string msgHTML (string $message, [string $basedir = ''], [bool $advanced = false])
  • string $message: HTML message string
  • string $basedir: baseline directory for path
  • bool $advanced: Whether to use the advanced HTML to text converter
postSend (line 1029)

Actually send a message.

Send the email via the selected mechanism

  • throws: phpmailerException
  • access: public
bool postSend ()
preSend (line 961)

Prepare a message for sending.

  • throws: phpmailerException
  • access: public
bool preSend ()
secureHeader (line 3143)

Strip newlines to prevent header injection.

  • access: public
string secureHeader (string $str)
  • string $str
send (line 939)

Create a message and send it.

Uses the sending method specified by $Mailer.

  • return: false on error - See the ErrorInfo property for details of the error.
  • throws: phpmailerException
  • access: public
bool send ()
sendmailSend (line 1068)

Send mail using the $Sendmail program.

bool sendmailSend (string $header, string $body)
  • string $header: The message headers
  • string $body: The message body
serverHostname (line 2777)

Get the server hostname.

Returns 'localhost.localdomain' if unknown.

  • access: protected
string serverHostname ()
set (line 3120)

Set or reset instance properties.

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

  • todo: Should this not be using __set() magic function?
  • throws: phpmailerException
  • access: public
bool set (string $name, [mixed $value = ''])
  • string $name
  • mixed $value: NOTE: will not work with arrays, there are no arrays to set/reset
setError (line 2745)

Add an error message to the error container.

  • access: protected
void setError (string $msg)
  • string $msg
setFrom (line 808)

Set the From and FromName properties.

  • throws: phpmailerException
  • access: public
bool setFrom (string $address, [string $name = ''], [bool $auto = true])
  • string $address
  • string $name
  • bool $auto: Whether to also set the Sender address, defaults to true
setLanguage (line 1372)

Set the language for error messages.

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

  • access: public
bool setLanguage ([string $langcode = 'en'], [string $lang_path = ''])
  • string $langcode: ISO 639-1 2-character language code (e.g. French is "fr")
  • string $lang_path: Path to the language file directory, with trailing separator (slash)
setMessageType (line 1997)

Set the message type.

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

  • access: protected
void setMessageType ()
setWordWrap (line 1598)

Set the body wrapping.

  • access: public
void setWordWrap ()
sign (line 3171)

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

  • access: public
void sign (string $cert_filename, string $key_filename, string $key_pass)
  • string $cert_filename
  • string $key_filename
  • string $key_pass: Password for private key
smtpClose (line 1353)

Close the active SMTP session if one exists.

  • access: public
void smtpClose ()
smtpConnect (line 1260)

Initiate a connection to an SMTP server.

Returns false if the operation failed.

  • throws: phpmailerException
  • access: public
  • uses: SMTP
bool smtpConnect ([array $options = array()])
  • array $options: An array of options compatible with stream_context_create()
smtpSend (line 1190)

Send mail via SMTP.

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

  • see: PHPMailer::getSMTPInstance() to use a different class.
  • throws: phpmailerException
  • access: protected
  • uses: SMTP
bool smtpSend (string $header, string $body)
  • string $header: The message headers
  • string $body: The message body
textLine (line 2033)

Return a formatted mail line.

  • access: public
string textLine (string $value)
  • string $value
utf8CharBoundary (line 1560)

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

Original written by Colin Brown.

  • access: public
int utf8CharBoundary (string $encodedText, int $maxLength)
  • string $encodedText: utf-8 QP text
  • int $maxLength: find last character boundary prior to this length
wrapText (line 1472)

Word-wrap message.

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

  • access: public
string wrapText (string $message, integer $length, [bool $qp_mode = false])
  • string $message: The message to wrap
  • integer $length: The line length to wrap to
  • bool $qp_mode: Whether to run in Quoted-Printable mode
Class Constants
CRLF = "\r\n" (line 562)

SMTP RFC standard line ending

STOP_CONTINUE = 1 (line 552)

Error severity: message, likely ok to continue processing

STOP_CRITICAL = 2 (line 557)

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

STOP_MESSAGE = 0 (line 547)

Error severity: message only, continue processing

Documentation generated on Sat, 25 Oct 2014 20:22:56 +0200 by phpDocumentor 1.4.4