Class PHPMailer

Description

PHPMailer - PHP email creation and transport class.

PHP Version 5.0.0

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


	
			
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 $lf = 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 $s)
string DKIM_QP (string $txt)
string DKIM_Sign (string $s)
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 ()
string getBoundary (string $boundary, string $charSet, string $contentType, string $encoding)
string getLastMessageID ()
string getMailMIME ()
string getSentMIMEMessage ()
array getTranslations ()
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 = '/usr/share/php/phpmailer/language/'])
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 416)

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:

  • 'function_name' for function names
  • 'Class::Method' for static method calls
  • array($object, 'Method') for calling methods on $object
See http://php.net/is_callable manual page for more details.

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

Whether to allow sending messages with an empty body.

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

An array of all kinds of addresses.

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

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

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

The array of attachments.

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

SMTP auth type.

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

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

The array of 'bcc' addresses.

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

An HTML or plain text message body.

If HTML then call isHTML(true).

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

The array of MIME boundary strings.

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

The array of 'cc' addresses.

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

The character set of the message.

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

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

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

The MIME Content-type of the message.

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

The array of custom headers.

  • access: protected
mixed $Debugoutput = "echo" (line 314)

The function/method to use for debugging output.

Options: "echo" or "error_log"

mixed $DKIM_domain = '' (line 385)

DKIM signing domain name.

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

DKIM Identity.

Usually the email address used as the source of the email

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

DKIM passphrase.

Used if your key is encrypted.

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

DKIM private key file path.

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

DKIM selector.

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

Whether to generate VERP addresses on send.

Only applicable when sending via SMTP.

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

The message encoding.

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

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

Holds the most recent mailer error message.

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

The number of errors encountered.

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

Whether to throw exceptions for errors.

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

The From email address for the message.

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

The From name of the message.

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

The SMTP HELO of the message.

Default is $Hostname.

mixed $Host = 'localhost' (line 228)

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

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

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

The array of available languages.

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

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

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

The default line ending.

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

Which method to use to send mail.

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

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

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

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

The message Date to be used in the Date header.

If empty, the current date will be added.

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

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

If empty, a unique id will be generated.

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

The message's MIME type.

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

The complete compiled MIME message body.

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

The complete compiled MIME message headers.

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

SMTP password.

  • access: public
mixed $PluginDir = '/usr/share/php/phpmail/' (line 188)

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

The default SMTP server port.

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

Email priority.

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

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

SMTP realm.

Used for NTLM auth

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

The array of reply-to names and addresses.

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

The Return-Path of the message.

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

  • access: public
mixed $Sender = '' (line 94)

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

The path to the sendmail program.

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

The S/MIME certificate file path.

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

The S/MIME key file path.

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

The S/MIME password for the key.

Used only if the key is encrypted.

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

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

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

Storage for addresses when SingleTo is enabled.

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

An instance of the SMTP sender class.

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

Whether to use SMTP authentication.

Uses the Username and Password properties.

mixed $SMTPDebug = 0 (line 306)

SMTP class debug output mode.

Options: 0 = off, 1 = commands, 2 = commands and data

mixed $SMTPKeepAlive = false (line 322)

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

The secure connection prefix.

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

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

The Subject of the message.

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

The SMTP server timeout in seconds.

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

The array of 'to' addresses.

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

SMTP username.

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

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

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

  • access: public
mixed $Version = '5.2.7' (line 43)

The PHPMailer Version number.

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

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

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

SMTP workstation.

Used for NTLM auth

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

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

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

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

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

Return an RFC 822 formatted date.

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

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 best 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; faster, less thorough; 'noregex' - super fast, really dumb.
static method _mime_types (line 2847)

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

Constructor

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

Destructor.

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

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

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

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

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

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

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

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

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

Add a "Reply-to" address.

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

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

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

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

Check if this message has an alternative body set.

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

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

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

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

Encode and wrap 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

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

Clear all To recipients.

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

Clear all recipient types.

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

Clear all filesystem, string, and binary attachments.

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

Clear all BCC recipients.

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

Clear all CC recipients.

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

Clear all custom headers.

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

Clear all ReplyTo recipients.

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

Assemble the message body.

Returns an empty string on failure.

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

Assemble message headers.

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

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

Generate a DKIM canonicalization body.

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

Generate a DKIM canonicalization header.

  • access: public
string DKIM_HeaderC (string $s)
  • string $s: Header
DKIM_QP (line 3086)

Quoted-Printable-encode a DKIM header.

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

Generate a DKIM signature.

  • throws: phpmailerException
  • access: public
string DKIM_Sign (string $s)
  • string $s: Header
doCallback (line 3244)

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

Output debugging info via user-defined method.

Only if debug output is enabled.

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

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

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

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

Encode a string in quoted-printable format.

According to RFC2045 section 6.7.

  • link: PHP
  • access: public
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 2353)

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

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

Return the end of a message boundary.

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

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
getAttachments (line 2013)

Return the array of attachments.

  • access: public
array getAttachments ()
getBoundary (line 1879)

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
getLastMessageID (line 823)

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

Get the message MIME type headers.

  • access: public
string getMailMIME ()
getSentMIMEMessage (line 1715)

Returns the whole MIME message.

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

  • see: PHPMailer::PreSend()
  • access: public
string getSentMIMEMessage ()
getSMTPInstance (line 1139)

Get an instance to use for SMTP operations.

Override this function to load your own SMTP implementation

  • access: public
SMTP getSMTPInstance ()
getTranslations (line 1363)

Get the array of strings for the current language.

  • access: public
array getTranslations ()
hasMultiBytes (line 2268)

Check if a string contains multi-byte characters.

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

Format a header line.

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

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

Check if an inline attachment is present.

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

Check if an error occurred.

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

Sets message type to HTML or plain.

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

Send messages using PHP's mail() function.

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

Send messages using qmail.

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

Send messages using $Sendmail.

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

Send messages using SMTP.

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

Get an error message in the current language.

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

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

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

Actually send a message.

Send the email via the selected mechanism

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

Prepare a message for sending.

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

Strip newlines to prevent header injection.

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

Create a message and send it.

Uses the sending method specified by $Mailer. Returns false on error - Use the ErrorInfo variable to view description of the error.

  • throws: phpmailerException
  • access: public
bool send ()
sendmailSend (line 1045)

Send mail using the $Sendmail program.

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

Get the server hostname.

Returns 'localhost.localdomain' if unknown.

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

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

Add an error message to the error container.

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

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

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 = '/usr/share/php/phpmailer/language/'])
  • 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 1918)

Set the message type.

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

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

Set the body wrapping.

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

Set the private key file 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 1307)

Close the active SMTP session if one exists.

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

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

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

Return a formatted mail line.

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

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

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

SMTP RFC standard line ending

STOP_CONTINUE = 1 (line 554)

Error severity: message, likely ok to continue processing

STOP_CRITICAL = 2 (line 559)

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

STOP_MESSAGE = 0 (line 549)

Error severity: message only, continue processing

Documentation generated on Sat, 09 Nov 2013 23:19:24 +0100 by phpDocumentor 1.4.4