# \PHPMailer

PHPMailer - PHP email creation and transport class.

## Summary

Methods
Properties
Constants
__construct()
__destruct()
isHTML()
isSMTP()
isMail()
isSendmail()
isQmail()
addAddress()
addCC()
addBCC()
addReplyTo()
setFrom()
getLastMessageID()
validateAddress()
send()
preSend()
postSend()
getSMTPInstance()
smtpConnect()
smtpClose()
setLanguage()
getTranslations()
addrAppend()
addrFormat()
wrapText()
utf8CharBoundary()
setWordWrap()
createHeader()
getMailMIME()
getSentMIMEMessage()
createBody()
headerLine()
textLine()
addAttachment()
getAttachments()
encodeString()
encodeHeader()
hasMultiBytes()
has8bitChars()
base64EncodeWrapMB()
encodeQP()
encodeQPphp()
encodeQ()
addStringAttachment()
addEmbeddedImage()
addStringEmbeddedImage()
inlineImageExists()
attachmentExists()
alternativeExists()
clearAddresses()
clearCCs()
clearBCCs()
clearReplyTos()
clearAllRecipients()
clearAttachments()
clearCustomHeaders()
rfcDate()
isError()
fixEOL()
addCustomHeader()
msgHTML()
html2text()
_mime_types()
filenameToType()
mb_pathinfo()
set()
secureHeader()
normalizeBreaks()
sign()
DKIM_QP()
DKIM_Sign()
DKIM_HeaderC()
DKIM_BodyC()
DKIM_Add()
getToAddresses()
getCcAddresses()
getBccAddresses()
getReplyToAddresses()
getAllRecipientAddresses()
$Version
$Priority
$CharSet
$ContentType
$Encoding
$ErrorInfo
$From
$FromName
$Sender
$ReturnPath
$Subject
$Body
$AltBody
$Ical
$WordWrap
$Mailer
$Sendmail
$UseSendmailOptions
$PluginDir
$ConfirmReadingTo
$Hostname
$MessageID
$MessageDate
$Host
$Port
$Helo
$SMTPSecure
$SMTPAuth
$Username
$Password
$AuthType
$Realm
$Workstation
$Timeout
$SMTPDebug
$Debugoutput
$SMTPKeepAlive
$SingleTo
$SingleToArray
$do_verp
$AllowEmpty
$LE
$DKIM_selector
$DKIM_identity
$DKIM_passphrase
$DKIM_domain
$DKIM_private
$action_function
$XMailer
STOP_MESSAGE
STOP_CONTINUE
STOP_CRITICAL
CRLF
edebug()
addAnAddress()
sendmailSend()
mailSend()
smtpSend()
getBoundary()
endBoundary()
setMessageType()
attachAll()
encodeFile()
setError()
serverHostname()
lang()
doCallback()
$MIMEBody
$MIMEHeader
$mailHeader
$smtp
$to
$cc
$bcc
$ReplyTo
$all_recipients
$attachment
$CustomHeader
$lastMessageID
$message_type
$boundary
$language
$error_count
$sign_cert_file
$sign_key_file
$sign_key_pass
$exceptions
N/A
mailPassthru()
No private properties found
N/A

File
  app/lib/PHPMailer.inc
Package
  PHPMailer
Class hierarchy
  \PHPMailer

## Tags

author | Marcus Bointon (Synchro/coolbru) phpmailer@synchromedia.co.uk Jim Jagielski (jimjag) jimjag@gmail.com Andy Prevost (codeworxtech) codeworxtech@users.sourceforge.net Brent R. Matzelle (original founder)

## Constants

### STOP_MESSAGE

    STOP_MESSAGE

Error severity: message only, continue processing

#

## Tags

None found

### STOP_CONTINUE

    STOP_CONTINUE

Error severity: message, likely ok to continue processing

#

## Tags

None found

### STOP_CRITICAL

    STOP_CRITICAL

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

#

## Tags

None found

### CRLF

    CRLF

SMTP RFC standard line ending

#

## Tags

None found

## Properties

### $Version

    $Version :

The PHPMailer Version number.

#### Type

#

## Tags

type | string

### $Priority

    $Priority :

Email priority.

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

#### Type

#

## Tags

type | int

### $CharSet

    $CharSet :

The character set of the message.

#### Type

#

## Tags

type | string

### $ContentType

    $ContentType :

The MIME Content-type of the message.

#### Type

#

## Tags

type | string

### $Encoding

    $Encoding :

The message encoding.

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

#### Type

#

## Tags

type | string

### $ErrorInfo

    $ErrorInfo :

Holds the most recent mailer error message.

#### Type

#

## Tags

type | string

### $From

    $From :

The From email address for the message.

#### Type

#

## Tags

type | string

### $FromName

    $FromName :

The From name of the message.

#### Type

#

## Tags

type | string

### $Sender

    $Sender :

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.

#### Type

#

## Tags

type | string

### $ReturnPath

    $ReturnPath :

The Return-Path of the message.

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

#### Type

#

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

See also
  RFC5321 reference

## Tags

type | string

### $Subject

    $Subject :

The Subject of the message.

#### Type

#

## Tags

type | string

### $Body

    $Body :

An HTML or plain text message body.

If HTML then call isHTML(true).

#### Type

#

## Tags

type | string

### $AltBody

    $AltBody :

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.

#### Type

#

## Tags

type | string

### $Ical

    $Ical :

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

#### Type

#

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

## Tags

type | string

### $WordWrap

    $WordWrap :

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

#### Type

#

## Tags

type | int

### $Mailer

    $Mailer :

Which method to use to send mail.

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

#### Type

#

## Tags

type | string

### $Sendmail

    $Sendmail :

The path to the sendmail program.

#### Type

#

## Tags

type | string

### $UseSendmailOptions

    $UseSendmailOptions :

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

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

#### Type

#

## Tags

type | bool

### $PluginDir

    $PluginDir :

Path to PHPMailer plugins.

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

#### Type

#

#### Deprecated

Should not be needed now there is an autoloader.

## Tags

type | string

### $ConfirmReadingTo

    $ConfirmReadingTo :

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

#### Type

#

## Tags

type | string

### $Hostname

    $Hostname :

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

#### Type

#

## Tags

type | string

### $MessageID

    $MessageID :

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

If empty, a unique id will be generated.

#### Type

#

## Tags

type | string

### $MessageDate

    $MessageDate :

The message Date to be used in the Date header.

If empty, the current date will be added.

#### Type

#

## Tags

type | string

### $Host

    $Host :

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.

#### Type

#

## Tags

type | string

### $Port

    $Port :

The default SMTP server port.

#### Type

#

## Tags

type | int
Todo | Why is this needed when the SMTP class takes care of it?

### $Helo

    $Helo :

The SMTP HELO of the message.

Default is $Hostname.

#### Type

#

See also

## Tags

type | string

### $SMTPSecure

    $SMTPSecure :

The secure connection prefix.

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

#### Type

#

## Tags

type | string

### $SMTPAuth

    $SMTPAuth :

Whether to use SMTP authentication.

Uses the Username and Password properties.

#### Type

#

See also

## Tags

type | bool

### $Username

    $Username :

SMTP username.

#### Type

#

## Tags

type | string

### $Password

    $Password :

SMTP password.

#### Type

#

## Tags

type | string

### $AuthType

    $AuthType :

SMTP auth type.

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

#### Type

#

## Tags

type | string

### $Realm

    $Realm :

SMTP realm.

Used for NTLM auth

#### Type

#

## Tags

type | string

### $Workstation

    $Workstation :

SMTP workstation.

Used for NTLM auth

#### Type

#

## Tags

type | string

### $Timeout

    $Timeout :

The SMTP server timeout in seconds.

#### Type

#

## Tags

type | int

### $SMTPDebug

    $SMTPDebug :

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

#### Type

#

See also

## Tags

type | int

### $Debugoutput

    $Debugoutput :

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

#### Type

#

See also

## Tags

type | string

### $SMTPKeepAlive

    $SMTPKeepAlive :

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

#### Type

#

## Tags

type | bool

### $SingleTo

    $SingleTo :

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

#### Type

#

## Tags

type | bool

### $SingleToArray

    $SingleToArray :

Storage for addresses when SingleTo is enabled.

#### Type

#

## Tags

type | array
todo | This should really not be public

### $do_verp

    $do_verp :

Whether to generate VERP addresses on send.

Only applicable when sending via SMTP.

#### Type

#

See also
  http://en.wikipedia.org/wiki/Variable_envelope_return_path
  Postfix VERP info

## Tags

type | bool

### $AllowEmpty

    $AllowEmpty :

Whether to allow sending messages with an empty body.

#### Type

#

## Tags

type | bool

### $LE

    $LE :

The default line ending.

#### Type

#

## Tags

note | The default remains "\n". We force CRLF where we know it must be used via self::CRLF.
type | string

### $DKIM_selector

    $DKIM_selector :

DKIM selector.

#### Type

#

## Tags

type | string

### $DKIM_identity

    $DKIM_identity :

DKIM Identity.

Usually the email address used as the source of the email

#### Type

#

## Tags

type | string

### $DKIM_passphrase

    $DKIM_passphrase :

DKIM passphrase.

Used if your key is encrypted.

#### Type

#

## Tags

type | string

### $DKIM_domain

    $DKIM_domain :

DKIM signing domain name.

#### Type

#

## Tags

example |
type | string

### $DKIM_private

    $DKIM_private :

DKIM private key file path.

#### Type

#

## Tags

type | string

### $action_function

    $action_function :

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

#### Type

#

## Tags

type | string

### $XMailer

    $XMailer :

What to use in the X-Mailer header.

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

#### Type

#

## Tags

type | string

### $MIMEBody

    $MIMEBody :

The complete compiled MIME message body.

#### Type

#

## Tags

type | string

### $MIMEHeader

    $MIMEHeader :

The complete compiled MIME message headers.

#### Type

#

## Tags

type | string

### $mailHeader

    $mailHeader :

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

#### Type

#

## Tags

type | string

### $smtp

    $smtp :

An instance of the SMTP sender class.

#### Type

#

## Tags

type | SMTP

### $to

    $to :

The array of 'to' addresses.

#### Type

#

## Tags

type | array

### $cc

    $cc :

The array of 'cc' addresses.

#### Type

#

## Tags

type | array

### $bcc

    $bcc :

The array of 'bcc' addresses.

#### Type

#

## Tags

type | array

### $ReplyTo

    $ReplyTo :

The array of reply-to names and addresses.

#### Type

#

## Tags

type | array

### $all_recipients

    $all_recipients :

An array of all kinds of addresses.

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

#### Type

#

## Tags

type | array

### $attachment

    $attachment :

The array of attachments.

#### Type

#

## Tags

type | array

### $CustomHeader

    $CustomHeader :

The array of custom headers.

#### Type

#

## Tags

type | array

### $lastMessageID

    $lastMessageID :

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

#### Type

#

## Tags

type | string

### $message_type

    $message_type :

The message's MIME type.

#### Type

#

## Tags

type | string

### $boundary

    $boundary :

The array of MIME boundary strings.

#### Type

#

## Tags

type | array

### $language

    $language :

The array of available languages.

#### Type

#

## Tags

type | array

### $error_count

    $error_count :

The number of errors encountered.

#### Type

#

## Tags

type | integer

### $sign_cert_file

    $sign_cert_file :

The S/MIME certificate file path.

#### Type

#

## Tags

type | string

### $sign_key_file

    $sign_key_file :

The S/MIME key file path.

#### Type

#

## Tags

type | string

### $sign_key_pass

    $sign_key_pass :

The S/MIME password for the key.

Used only if the key is encrypted.

#### Type

#

## Tags

type | string

### $exceptions

    $exceptions :

Whether to throw exceptions for errors.

#### Type

#

## Tags

type | bool

## Methods

### __construct()

    __construct(boolean  $exceptions = false)

Constructor

#### Parameters

boolean | $exceptions | Should we throw external exceptions?

#

## Tags

None found

### __destruct()

    __destruct()

Destructor.

#

## Tags

None found

### isHTML()

    isHTML(boolean  $ishtml = true) : void

Sets message type to HTML or plain.

#### Parameters

boolean | $ishtml | True for HTML mode.

#

## Tags

None found

### isSMTP()

    isSMTP() : void

Send messages using SMTP.

#

## Tags

None found

### isMail()

    isMail() : void

Send messages using PHP's mail() function.

#

## Tags

None found

### isSendmail()

    isSendmail() : void

Send messages using $Sendmail.

#

## Tags

None found

### isQmail()

    isQmail() : void

Send messages using qmail.

#

## Tags

None found

### addAddress()

    addAddress(string  $address, string  $name = '') : boolean

Add a "To" address.

#### Parameters

string | $address |
string | $name |

#### Returns

boolean —

true on success, false if address already used

#

## Tags

None found

### addCC()

    addCC(string  $address, string  $name = '') : boolean

Add a "CC" address.

#### Parameters

string | $address |
string | $name |

#### Returns

boolean —

true on success, false if address already used

#

## Tags

note | : This function works with the SMTP mailer on win32, not with the "mail" mailer.

### addBCC()

    addBCC(string  $address, string  $name = '') : boolean

Add a "BCC" address.

#### Parameters

string | $address |
string | $name |

#### Returns

boolean —

true on success, false if address already used

#

## Tags

note | : This function works with the SMTP mailer on win32, not with the "mail" mailer.

### addReplyTo()

    addReplyTo(string  $address, string  $name = '') : boolean

Add a "Reply-to" address.

#### Parameters

string | $address |
string | $name |

#### Returns

boolean

#

## Tags

None found

### setFrom()

    setFrom(string  $address, string  $name = '', boolean  $auto = true) : boolean

Set the From and FromName properties.

#### Parameters

string | $address |
string | $name |
boolean | $auto | Whether to also set the Sender address, defaults to true

#### Throws

\phpmailerException

#### Returns

boolean

#

## Tags

None found

### getLastMessageID()

    getLastMessageID() : string

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.

#### Returns

string

#

## Tags

None found

### validateAddress()

    validateAddress(string  $address, string  $patternselect = 'auto') : boolean

Check that a string looks like an email address.

#### Parameters

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.

#### Returns

boolean

#

static

## Tags

static |

### send()

    send() : boolean

Create a message and send it.

Uses the sending method specified by $Mailer.

#### Throws

\phpmailerException

#### Returns

boolean —

false on error - See the ErrorInfo property for details of the error.

#

## Tags

None found

### preSend()

    preSend() : boolean

Prepare a message for sending.

#### Throws

\phpmailerException

#### Returns

boolean

#

## Tags

None found

### postSend()

    postSend() : boolean

Actually send a message.

Send the email via the selected mechanism

#### Throws

\phpmailerException

#### Returns

boolean

#

## Tags

None found

### getSMTPInstance()

    getSMTPInstance() : \SMTP

Get an instance to use for SMTP operations.

Override this function to load your own SMTP implementation

#### Returns

\SMTP

#

## Tags

None found

### smtpConnect()

    smtpConnect(array  $options = array()) : boolean

Initiate a connection to an SMTP server.

Returns false if the operation failed.

#### Parameters

array | $options | An array of options compatible with stream_context_create()

#### Throws

\phpmailerException

#### Returns

boolean

#

Uses
  SMTP

## Tags

None found

### smtpClose()

    smtpClose() : void

Close the active SMTP session if one exists.

#

## Tags

None found

### setLanguage()

    setLanguage(string  $langcode = 'en', string  $lang_path = '') : boolean

Set the language for error messages.

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

#### Parameters

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)

#### Returns

boolean

#

## Tags

None found

### getTranslations()

    getTranslations() : array

Get the array of strings for the current language.

#### Returns

array

#

## Tags

None found

### addrAppend()

    addrAppend(string  $type, array  $addr) : string

Create recipient headers.

#### Parameters

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

#### Returns

string

#

## Tags

None found

### addrFormat()

    addrFormat(array  $addr) : string

Format an address for use in a message header.

#### Parameters

array | $addr | A 2-element indexed array, element 0 containing an address, element 1 containing a name like array('joe@example.com', 'Joe User')

#### Returns

string

#

## Tags

None found

### wrapText()

    wrapText(string  $message, integer  $length, boolean  $qp_mode = false) : string

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 | $message | The message to wrap
integer | $length | The line length to wrap to
boolean | $qp_mode | Whether to run in Quoted-Printable mode

#### Returns

string

#

## Tags

None found

### utf8CharBoundary()

    utf8CharBoundary(string  $encodedText, integer  $maxLength) : integer

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

Original written by Colin Brown.

#### Parameters

string | $encodedText | utf-8 QP text
integer | $maxLength | find last character boundary prior to this length

#### Returns

integer

#

## Tags

None found

### setWordWrap()

    setWordWrap() : void

Set the body wrapping.

#

## Tags

None found

### createHeader()

    createHeader() : string

Assemble message headers.

#### Returns

string —

The assembled headers

#

## Tags

None found

### getMailMIME()

    getMailMIME() : string

Get the message MIME type headers.

#### Returns

string

#

## Tags

None found

### getSentMIMEMessage()

    getSentMIMEMessage() : string

Returns the whole MIME message.

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

#### Returns

string

#

See also

## Tags

None found

### createBody()

    createBody() : string

Assemble the message body.

Returns an empty string on failure.

#### Throws

\phpmailerException

#### Returns

string —

The assembled message body

#

## Tags

None found

### headerLine()

    headerLine(string  $name, string  $value) : string

Format a header line.

#### Parameters

string | $name |
string | $value |

#### Returns

string

#

## Tags

None found

### textLine()

    textLine(string  $value) : string

Return a formatted mail line.

#### Parameters

string | $value |

#### Returns

string

#

## Tags

None found

### addAttachment()

    addAttachment(string  $path, string  $name = '', string  $encoding = 'base64', string  $type = '', string  $disposition = 'attachment') : boolean

Add an attachment from a path on the filesystem.

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

#### Parameters

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

#### Throws

\phpmailerException

#### Returns

boolean

#

## Tags

None found

### getAttachments()

    getAttachments() : array

Return the array of attachments.

#### Returns

array

#

## Tags

None found

### encodeString()

    encodeString(string  $str, string  $encoding = 'base64') : string

Encode a string in requested format.

Returns an empty string on failure.

#### Parameters

string | $str | The text to encode
string | $encoding | The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

#### Returns

string

#

## Tags

None found

### encodeHeader()

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

Encode a header string optimally.

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

#### Parameters

string | $str |
string | $position |

#### Returns

string

#

## Tags

None found

### hasMultiBytes()

    hasMultiBytes(string  $str) : boolean

Check if a string contains multi-byte characters.

#### Parameters

string | $str | multi-byte text to wrap encode

#### Returns

boolean

#

## Tags

None found

### has8bitChars()

    has8bitChars(string  $text) : boolean

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

#### Parameters

string | $text |

#### Returns

boolean

#

## Tags

None found

### base64EncodeWrapMB()

    base64EncodeWrapMB(string  $str, string  $linebreak = null) : string

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

Adapted from a function by paravoid

#### Parameters

string | $str | multi-byte text to wrap encode
string | $linebreak | string to use as linefeed/end-of-line

#### Returns

string

#

See also
  http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283

## Tags

None found

### encodeQP()

    encodeQP(string  $string, integer  $line_max = 76) : string

Encode a string in quoted-printable format.

According to RFC2045 section 6.7.

#### Parameters

string | $string | The text to encode
integer | $line_max | Number of chars allowed on a line before wrapping

#### Returns

string

#

See also
  Adapted from this comment

## Tags

None found

### encodeQPphp()

    encodeQPphp(string  $string, integer  $line_max = 76, boolean  $space_conv = false) : string

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

#### Parameters

string | $string |
integer | $line_max |
boolean | $space_conv |

#### Returns

string

#

#### Deprecated

Use encodeQP instead.

See also

## Tags

None found

### encodeQ()

    encodeQ(string  $str, string  $position = 'text') : string

Encode a string using Q encoding.

#### Parameters

string | $str | the text to encode
string | $position | Where the text is going to be used, see the RFC for what that means

#### Returns

string

#

See also
  http://tools.ietf.org/html/rfc2047

## Tags

None found

### addStringAttachment()

    addStringAttachment(string  $string, string  $filename, string  $encoding = 'base64', string  $type = '', string  $disposition = 'attachment') : void

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 | $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

#

## Tags

None found

### addEmbeddedImage()

    addEmbeddedImage(string  $path, string  $cid, string  $name = '', string  $encoding = 'base64', string  $type = '', string  $disposition = 'inline') : boolean

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.

#### Parameters

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

#### Returns

boolean —

True on successfully adding an attachment

#

## Tags

None found

### addStringEmbeddedImage()

    addStringEmbeddedImage(string  $string, string  $cid, string  $name = '', string  $encoding = 'base64', string  $type = '', string  $disposition = 'inline') : boolean

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

#### Parameters

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

#### Returns

boolean —

True on successfully adding an attachment

#

## Tags

None found

### inlineImageExists()

    inlineImageExists() : boolean

Check if an inline attachment is present.

#### Returns

boolean

#

## Tags

None found

### attachmentExists()

    attachmentExists() : boolean

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

#### Returns

boolean

#

## Tags

None found

### alternativeExists()

    alternativeExists() : boolean

Check if this message has an alternative body set.

#### Returns

boolean

#

## Tags

None found

### clearAddresses()

    clearAddresses() : void

Clear all To recipients.

#

## Tags

None found

### clearCCs()

    clearCCs() : void

Clear all CC recipients.

#

## Tags

None found

### clearBCCs()

    clearBCCs() : void

Clear all BCC recipients.

#

## Tags

None found

### clearReplyTos()

    clearReplyTos() : void

Clear all ReplyTo recipients.

#

## Tags

None found

### clearAllRecipients()

    clearAllRecipients() : void

Clear all recipient types.

#

## Tags

None found

### clearAttachments()

    clearAttachments() : void

Clear all filesystem, string, and binary attachments.

#

## Tags

None found

### clearCustomHeaders()

    clearCustomHeaders() : void

Clear all custom headers.

#

## Tags

None found

### rfcDate()

    rfcDate() : string

Return an RFC 822 formatted date.

#### Returns

string

#

static

## Tags

static |

### isError()

    isError() : boolean

Check if an error occurred.

#### Returns

boolean —

True if an error did occur.

#

## Tags

None found

### fixEOL()

    fixEOL(string  $str) : string

Ensure consistent line endings in a string.

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

#### Parameters

string | $str | String to fixEOL

#### Returns

string

#

## Tags

None found

### addCustomHeader()

    addCustomHeader(string  $name, string  $value = null) : void

Add a custom header.

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

#### Parameters

string | $name | Custom header name
string | $value | Header value

#

## Tags

None found

### msgHTML()

    msgHTML(string  $message, string  $basedir = '', boolean  $advanced = false) : string

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

#### Parameters

string | $message | HTML message string
string | $basedir | baseline directory for path
boolean | $advanced | Whether to use the advanced HTML to text converter

#### Returns

string —

$message

#

## Tags

None found

### html2text()

    html2text(string  $html, boolean  $advanced = false) : string

Convert an HTML string into plain text.

#### Parameters

string | $html | The HTML text to convert
boolean | $advanced | Should this use the more complex html2text converter or just a simple one?

#### Returns

string

#

## Tags

None found

### _mime_types()

    _mime_types(string  $ext = '') : string

Get the MIME type for a file extension.

#### Parameters

string | $ext | File extension

#### Returns

string —

MIME type of file.

#

static

## Tags

static |

### filenameToType()

    filenameToType(string  $filename) : string

Map a file name to a MIME type.

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

#### Parameters

string | $filename | A file name or full path, does not need to exist as a file

#### Returns

string

#

static

## Tags

static |

### mb_pathinfo()

    mb_pathinfo(string  $path, integer|string  $options = null) : string|array

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

#### Parameters

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

#### Returns

string|array

#

static

See also
  http://www.php.net/manual/en/function.pathinfo.php#107461

## Tags

static |

### set()

    set(string  $name, mixed  $value = '') : boolean

Set or reset instance properties.

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

#### Parameters

string | $name |
mixed | $value | NOTE: will not work with arrays, there are no arrays to set/reset

#### Throws

\phpmailerException

#### Returns

boolean

#

## Tags

todo | Should this not be using __set() magic function?

### secureHeader()

    secureHeader(string  $str) : string

Strip newlines to prevent header injection.

#### Parameters

string | $str |

#### Returns

string

#

## Tags

None found

### normalizeBreaks()

    normalizeBreaks(string  $text, string  $breaktype = "\r\n") : string

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 | $breaktype | What kind of line break to use, defaults to CRLF

#### Returns

string

#

static

## Tags

static |

### sign()

    sign(string  $cert_filename, string  $key_filename, string  $key_pass)

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

#### Parameters

string | $cert_filename |
string | $key_filename |
string | $key_pass | Password for private key

#

## Tags

None found

### DKIM_QP()

    DKIM_QP(string  $txt) : string

Quoted-Printable-encode a DKIM header.

#### Parameters

string | $txt |

#### Returns

string

#

## Tags

None found

### DKIM_Sign()

    DKIM_Sign(string  $signheader) : string

Generate a DKIM signature.

#### Parameters

string | $signheader | Header

#### Throws

\phpmailerException

#### Returns

string

#

## Tags

None found

### DKIM_HeaderC()

    DKIM_HeaderC(string  $signheader) : string

Generate a DKIM canonicalization header.

#### Parameters

string | $signheader | Header

#### Returns

string

#

## Tags

None found

### DKIM_BodyC()

    DKIM_BodyC(string  $body) : string

Generate a DKIM canonicalization body.

#### Parameters

string | $body | Message Body

#### Returns

string

#

## Tags

None found

### DKIM_Add()

    DKIM_Add(string  $headers_line, string  $subject, string  $body) : string

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

#### Parameters

string | $headers_line | Header lines
string | $subject | Subject
string | $body | Body

#### Returns

string

#

## Tags

None found

### getToAddresses()

    getToAddresses() : array

Allows for public read access to 'to' property.

#### Returns

array

#

## Tags

None found

### getCcAddresses()

    getCcAddresses() : array

Allows for public read access to 'cc' property.

#### Returns

array

#

## Tags

None found

### getBccAddresses()

    getBccAddresses() : array

Allows for public read access to 'bcc' property.

#### Returns

array

#

## Tags

None found

### getReplyToAddresses()

    getReplyToAddresses() : array

Allows for public read access to 'ReplyTo' property.

#### Returns

array

#

## Tags

None found

### getAllRecipientAddresses()

    getAllRecipientAddresses() : array

Allows for public read access to 'all_recipients' property.

#### Returns

array

#

## Tags

None found

### edebug()

    edebug(string  $str)

Output debugging info via user-defined method.

Only if debug output is enabled.

#### Parameters

string | $str |

#

See also

## Tags

None found

### addAnAddress()

    addAnAddress(string  $kind, string  $address, string  $name = '') : boolean

Add an address to one of the recipient arrays.

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

#### Parameters

string | $kind | One of 'to', 'cc', 'bcc', 'ReplyTo'
string | $address | The email address to send to
string | $name |

#### Throws

\phpmailerException

#### Returns

boolean —

true on success, false if address already used or invalid in some way

#

## Tags

None found

### sendmailSend()

    sendmailSend(string  $header, string  $body) : boolean

Send mail using the $Sendmail program.

#### Parameters

string | $header | The message headers
string | $body | The message body

#### Throws

\phpmailerException

#### Returns

boolean

#

See also

## Tags

None found

### mailSend()

    mailSend(string  $header, string  $body) : boolean

Send mail using the PHP mail() function.

#### Parameters

string | $header | The message headers
string | $body | The message body

#### Throws

\phpmailerException

#### Returns

boolean

#

See also
  http://www.php.net/manual/en/book.mail.php

## Tags

None found

### smtpSend()

    smtpSend(string  $header, string  $body) : boolean

Send mail via SMTP.

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

#### Parameters

string | $header | The message headers
string | $body | The message body

#### Throws

\phpmailerException

#### Returns

boolean

#

See also
  to use a different class.
Uses
  SMTP

## Tags

None found

### getBoundary()

    getBoundary(string  $boundary, string  $charSet, string  $contentType, string  $encoding) : string

Return the start of a message boundary.

#### Parameters

string | $boundary |
string | $charSet |
string | $contentType |
string | $encoding |

#### Returns

string

#

## Tags

None found

### endBoundary()

    endBoundary(string  $boundary) : string

Return the end of a message boundary.

#### Parameters

string | $boundary |

#### Returns

string

#

## Tags

None found

### setMessageType()

    setMessageType() : void

Set the message type.

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

#

## Tags

None found

### attachAll()

    attachAll(string  $disposition_type, string  $boundary) : string

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

Returns an empty string on failure.

#### Parameters

string | $disposition_type |
string | $boundary |

#### Returns

string

#

## Tags

None found

### encodeFile()

    encodeFile(string  $path, string  $encoding = 'base64') : string

Encode a file attachment in requested format.

Returns an empty string on failure.

#### Parameters

string | $path | The full path to the file
string | $encoding | The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

#### Throws

\phpmailerException

#### Returns

string

#

See also

## Tags

None found

### setError()

    setError(string  $msg) : void

Add an error message to the error container.

#### Parameters

string | $msg |

#

## Tags

None found

### serverHostname()

    serverHostname() : string

Get the server hostname.

Returns 'localhost.localdomain' if unknown.

#### Returns

string

#

## Tags

None found

### lang()

    lang(string  $key) : string

Get an error message in the current language.

#### Parameters

string | $key |

#### Returns

string

#

## Tags

None found

### doCallback()

    doCallback(boolean  $isSent, string  $to, string  $cc, string  $bcc, string  $subject, string  $body, string  $from = null)

Perform a callback.

#### Parameters

boolean | $isSent |
string | $to |
string | $cc |
string | $bcc |
string | $subject |
string | $body |
string | $from |

#

## Tags

None found

### mailPassthru()

    mailPassthru(string  $to, string  $subject, string  $body, string  $header, string  $params) : boolean

Call mail() in a safe_mode-aware fashion.

Also, unless sendmail_path points to sendmail (or something that claims to be sendmail), don't pass params (not a perfect fix, but it will do)

#### Parameters

string | $to | To
string | $subject | Subject
string | $body | Message Body
string | $header | Additional Header(s)
string | $params | Params

#### Returns

boolean

#

## Tags

None found

### PHPMailer.inc