phpDocumentor PHPMailer
[ class tree: PHPMailer ] [ index: PHPMailer ] [ all elements ]

Class: PHPMailer

Source Location: /core/PHPMailer/class.phpmailer.php

Class PHPMailer

Class Overview

PHPMailer - PHP email creation and transport class.

Located in /core/PHPMailer/class.phpmailer.php [line 28]



		
				Author(s):
		
		
		
Information Tags:

Properties

Methods

[ Top ]
Constant Summary
CRLF   SMTP RFC standard line ending.
STOP_CONTINUE   Error severity: message, likely ok to continue processing.
STOP_CRITICAL   Error severity: message, plus full stop, critical error reached.
STOP_MESSAGE   Error severity: message only, continue processing.

[ Top ]
Property Summary
mixed   $action_function   Callback Action function name.
mixed   $AllowEmpty   Whether to allow sending messages with an empty body.
mixed   $all_recipients   An array of all kinds of addresses.
mixed   $AltBody   The plain-text message body.
mixed   $attachment   The array of attachments.
mixed   $AuthType   SMTP auth type.
mixed   $bcc   The array of 'bcc' addresses.
mixed   $Body   An HTML or plain text message body.
mixed   $boundary   The array of MIME boundary strings.
mixed   $cc   The array of 'cc' addresses.
mixed   $CharSet   The character set of the message.
mixed   $ConfirmReadingTo   The email address that a reading confirmation should be sent to.
mixed   $ContentType   The MIME Content-type of the message.
mixed   $CustomHeader   The array of custom headers.
mixed   $Debugoutput   How to handle debug output.
mixed   $DKIM_domain   DKIM signing domain name.
mixed   $DKIM_identity   DKIM Identity.
mixed   $DKIM_passphrase   DKIM passphrase.
mixed   $DKIM_private   DKIM private key file path.
mixed   $DKIM_selector   DKIM selector.
mixed   $do_verp   Whether to generate VERP addresses on send.
mixed   $Encoding   The message encoding.
mixed   $ErrorInfo   Holds the most recent mailer error message.
mixed   $error_count   The number of errors encountered.
mixed   $exceptions   Whether to throw exceptions for errors.
mixed   $From   The From email address for the message.
mixed   $FromName   The From name of the message.
mixed   $Helo   The SMTP HELO of the message.
mixed   $Host   SMTP hosts.
mixed   $Hostname   The hostname to use in Message-Id and Received headers and as default HELO string.
mixed   $Ical   An iCal message part body.
mixed   $language   The array of available languages.
mixed   $lastMessageID   The most recent Message-ID (including angular brackets).
mixed   $LE   The default line ending.
mixed   $Mailer   Which method to use to send mail.
mixed   $mailHeader   Extra headers that createHeader() doesn't fold in.
mixed   $MessageDate   The message Date to be used in the Date header.
mixed   $MessageID   An ID to be used in the Message-Id header.
mixed   $message_type   The message's MIME type.
mixed   $MIMEBody   The complete compiled MIME message body.
mixed   $MIMEHeader   The complete compiled MIME message headers.
mixed   $Password   SMTP password.
mixed   $PluginDir   Path to PHPMailer plugins.
mixed   $Port   The default SMTP server port.
mixed   $Priority   Email priority.
mixed   $Realm   SMTP realm.
mixed   $ReplyTo   The array of reply-to names and addresses.
mixed   $ReturnPath   The Return-Path of the message.
mixed   $Sender   The Sender email (Return-Path) of the message.
mixed   $Sendmail   The path to the sendmail program.
mixed   $sign_cert_file   The S/MIME certificate file path.
mixed   $sign_key_file   The S/MIME key file path.
mixed   $sign_key_pass   The S/MIME password for the key.
mixed   $SingleTo   Whether to split multiple to addresses into multiple messages or send them all in one message.
mixed   $SingleToArray   Storage for addresses when SingleTo is enabled.
mixed   $smtp   An instance of the SMTP sender class.
mixed   $SMTPAuth   Whether to use SMTP authentication.
mixed   $SMTPDebug   SMTP class debug output mode.
mixed   $SMTPKeepAlive   Whether to keep SMTP connection open after each message.
mixed   $SMTPSecure   The secure connection prefix.
mixed   $Subject   The Subject of the message.
mixed   $Timeout   The SMTP server timeout in seconds.
mixed   $to   The array of 'to' addresses.
mixed   $Username   SMTP username.
mixed   $UseSendmailOptions   Whether mail() uses a fully sendmail-compatible MTA.
mixed   $Version   The PHPMailer Version number.
mixed   $WordWrap   Word-wrap the message body to this number of chars.
mixed   $Workstation   SMTP workstation.
mixed   $XMailer   What to use in the X-Mailer header.

[ Top ]
Method Summary
static string   filenameToType()   Map a file name to a MIME type.
static string|array   mb_pathinfo()   Multi-byte-safe pathinfo replacement.
static string   normalizeBreaks()   Normalize line breaks in a string.
static string   rfcDate()   Return an RFC 822 formatted date.
static boolean   validateAddress()   Check that a string looks like an email address.
static string   _mime_types()   Get the MIME type for a file extension.
PHPMailer   __construct()   Constructor.
void   __destruct()   Destructor.
boolean   addAddress()   Add a "To" address.
boolean   addAnAddress()   Add an address to one of the recipient arrays.
boolean   addAttachment()   Add an attachment from a path on the filesystem.
boolean   addBCC()   Add a "BCC" address.
boolean   addCC()   Add a "CC" address.
void   addCustomHeader()   Add a custom header.
boolean   addEmbeddedImage()   Add an embedded (inline) attachment from a file.
string   addrAppend()   Create recipient headers.
boolean   addReplyTo()   Add a "Reply-to" address.
string   addrFormat()   Format an address for use in a message header.
void   addStringAttachment()   Add a string or binary attachment (non-filesystem).
boolean   addStringEmbeddedImage()   Add an embedded stringified attachment.
boolean   alternativeExists()   Check if this message has an alternative body set.
string   attachAll()   Attach all file, string, and binary attachments to the message.
boolean   attachmentExists()   Check if an attachment (non-inline) is present.
string   base64EncodeWrapMB()   Encode and wrap long multibyte strings for mail headers without breaking lines within a character.
void   clearAddresses()   Clear all To recipients.
void   clearAllRecipients()   Clear all recipient types.
void   clearAttachments()   Clear all filesystem, string, and binary attachments.
void   clearBCCs()   Clear all BCC recipients.
void   clearCCs()   Clear all CC recipients.
void   clearCustomHeaders()   Clear all custom headers.
void   clearReplyTos()   Clear all ReplyTo recipients.
string   createBody()   Assemble the message body.
string   createHeader()   Assemble message headers.
string   DKIM_Add()   Create the DKIM header and body in a new message header.
string   DKIM_BodyC()   Generate a DKIM canonicalization body.
string   DKIM_HeaderC()   Generate a DKIM canonicalization header.
string   DKIM_QP()   Quoted-Printable-encode a DKIM header.
string   DKIM_Sign()   Generate a DKIM signature.
void   doCallback()   Perform a callback.
void   edebug()   Output debugging info via user-defined method.
string   encodeFile()   Encode a file attachment in requested format.
string   encodeHeader()   Encode a header string optimally.
string   encodeQ()   Encode a string using Q encoding.
string   encodeQP()   Encode a string in quoted-printable format.
string   encodeQPphp()   Backward compatibility wrapper for an old QP encoding function that was removed.
string   encodeString()   Encode a string in requested format.
string   endBoundary()   Return the end of a message boundary.
string   fixEOL()   Ensure consistent line endings in a string.
array   getAllRecipientAddresses()   Allows for public read access to 'all_recipients' property.
array   getAttachments()   Return the array of attachments.
array   getBccAddresses()   Allows for public read access to 'bcc' property.
string   getBoundary()   Return the start of a message boundary.
array   getCcAddresses()   Allows for public read access to 'cc' property.
string   getLastMessageID()   Return the Message-ID header of the last email.
string   getMailMIME()   Get the message MIME type headers.
array   getReplyToAddresses()   Allows for public read access to 'ReplyTo' property.
string   getSentMIMEMessage()   Returns the whole MIME message.
SMTP   getSMTPInstance()   Get an instance to use for SMTP operations.
array   getToAddresses()   Allows for public read access to 'to' property.
array   getTranslations()   Get the array of strings for the current language.
boolean   has8bitChars()   Does a string contain any 8-bit chars (in any charset)?
boolean   hasMultiBytes()   Check if a string contains multi-byte characters.
string   headerLine()   Format a header line.
string   html2text()   Convert an HTML string into plain text.
boolean   inlineImageExists()   Check if an inline attachment is present.
boolean   isError()   Check if an error occurred.
void   isHTML()   Sets message type to HTML or plain.
void   isMail()   Send messages using PHP's mail() function.
void   isQmail()   Send messages using qmail.
void   isSendmail()   Send messages using $Sendmail.
void   isSMTP()   Send messages using SMTP.
string   lang()   Get an error message in the current language.
boolean   mailSend()   Send mail using the PHP mail() function.
string   msgHTML()   Create a message from an HTML string.
boolean   postSend()   Actually send a message.
boolean   preSend()   Prepare a message for sending.
string   secureHeader()   Strip newlines to prevent header injection.
boolean   send()   Create a message and send it.
boolean   sendmailSend()   Send mail using the $Sendmail program.
string   serverHostname()   Get the server hostname.
boolean   set()   Set or reset instance properties.
void   setError()   Add an error message to the error container.
boolean   setFrom()   Set the From and FromName properties.
boolean   setLanguage()   Set the language for error messages.
void   setMessageType()   Set the message type.
void   setWordWrap()   Set the body wrapping.
void   sign()   Set the public and private key files and password for S/MIME signing.
void   smtpClose()   Close the active SMTP session if one exists.
boolean   smtpConnect()   Initiate a connection to an SMTP server.
boolean   smtpSend()   Send mail via SMTP.
string   textLine()   Return a formatted mail line.
integer   utf8CharBoundary()   Find the last character boundary prior to $maxLength in a utf-8 quoted (printable) encoded string.
string   wrapText()   Word-wrap message.

[ Top ]
Properties
mixed   $action_function = '' [line 422]

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

API Tags:
Access:  public


[ Top ]
mixed   $AllowEmpty = false [line 361]

Whether to allow sending messages with an empty body.

API Tags:
Access:  public


[ Top ]
mixed   $all_recipients = array() [line 472]

An array of all kinds of addresses.

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

API Tags:
Access:  protected


[ Top ]
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.

API Tags:
Access:  public


[ Top ]
mixed   $attachment = array() [line 479]

The array of attachments.

API Tags:
Access:  protected


[ Top ]
mixed   $AuthType = '' [line 274]

SMTP auth type.

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

API Tags:
Access:  public


[ Top ]
mixed   $bcc = array() [line 457]

The array of 'bcc' addresses.

API Tags:
Access:  protected


[ Top ]
mixed   $Body = '' [line 108]

An HTML or plain text message body.

If HTML then call isHTML(true).

API Tags:
Access:  public


[ Top ]
mixed   $boundary = array() [line 507]

The array of MIME boundary strings.

API Tags:
Access:  protected


[ Top ]
mixed   $cc = array() [line 450]

The array of 'cc' addresses.

API Tags:
Access:  protected


[ Top ]
mixed   $CharSet = 'iso-8859-1' [line 47]

The character set of the message.

API Tags:
Access:  public


[ Top ]
mixed   $ConfirmReadingTo = '' [line 188]

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

API Tags:
Access:  public


[ Top ]
mixed   $ContentType = 'text/plain' [line 53]

The MIME Content-type of the message.

API Tags:
Access:  public


[ Top ]
mixed   $CustomHeader = array() [line 486]

The array of custom headers.

API Tags:
Access:  protected


[ Top ]
mixed   $Debugoutput = 'echo' [line 324]

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

Alternatively, you can provide a callable expecting two params: a message string and the debug level:

  1.  $mail->Debugoutput function($str$level{echo "debug level $level; message: $str";};

API Tags:
See:  SMTP::$Debugoutput
Access:  public


[ Top ]
mixed   $DKIM_domain = '' [line 396]

DKIM signing domain name.

API Tags:
Access:  public
Example:  example not found


[ Top ]
mixed   $DKIM_identity = '' [line 382]

DKIM Identity.

Usually the email address used as the source of the email

API Tags:
Access:  public


[ Top ]
mixed   $DKIM_passphrase = '' [line 389]

DKIM passphrase.

Used if your key is encrypted.

API Tags:
Access:  public


[ Top ]
mixed   $DKIM_private = '' [line 402]

DKIM private key file path.

API Tags:
Access:  public


[ Top ]
mixed   $DKIM_selector = '' [line 375]

DKIM selector.

API Tags:
Access:  public


[ Top ]
mixed   $do_verp = false [line 355]

Whether to generate VERP addresses on send.

Only applicable when sending via SMTP.

API Tags:
Access:  public

Information Tags:
Link:  http://en.wikipedia.org/wiki/Variable_envelope_return_path
Link:  Postfix VERP info

[ Top ]
mixed   $Encoding = '8bit' [line 60]

The message encoding.

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

API Tags:
Access:  public


[ Top ]
mixed   $ErrorInfo = '' [line 66]

Holds the most recent mailer error message.

API Tags:
Access:  public


[ Top ]
mixed   $error_count = 0 [line 521]

The number of errors encountered.

API Tags:
Access:  protected


[ Top ]
mixed   $exceptions = false [line 550]

Whether to throw exceptions for errors.

API Tags:
Access:  protected


[ Top ]
mixed   $From = 'root@localhost' [line 72]

The From email address for the message.

API Tags:
Access:  public


[ Top ]
mixed   $FromName = 'Root User' [line 78]

The From name of the message.

API Tags:
Access:  public


[ Top ]
mixed   $Helo = '' [line 239]

The SMTP HELO of the message.

Default is $Hostname.

API Tags:
See:  PHPMailer::$Hostname
Access:  public


[ Top ]
mixed   $Host = 'localhost' [line 224]

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"). You can also specify encryption type, for example: (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). Hosts will be tried in order.

API Tags:
Access:  public


[ Top ]
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'.

API Tags:
Access:  public


[ Top ]
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

API Tags:
Access:  public

Information Tags:
Link:  http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/
Link:  http://kigkonsult.se/iCalcreator/

[ Top ]
mixed   $language = array() [line 514]

The array of available languages.

API Tags:
Access:  protected


[ Top ]
mixed   $lastMessageID = '' [line 493]

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

API Tags:
Access:  protected


[ Top ]
mixed   $LE = "\n" [line 369]

The default line ending.

API Tags:
Access:  public


[ Top ]
mixed   $Mailer = 'mail' [line 161]

Which method to use to send mail.

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

API Tags:
Access:  public


[ Top ]
mixed   $mailHeader = '' [line 148]

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

API Tags:
Access:  protected


[ Top ]
mixed   $MessageDate = '' [line 211]

The message Date to be used in the Date header.

If empty, the current date will be added.

API Tags:
Access:  public


[ Top ]
mixed   $MessageID = '' [line 204]

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

If empty, a unique id will be generated.

API Tags:
Access:  public


[ Top ]
mixed   $message_type = '' [line 500]

The message's MIME type.

API Tags:
Access:  protected


[ Top ]
mixed   $MIMEBody = '' [line 134]

The complete compiled MIME message body.

API Tags:
Access:  protected


[ Top ]
mixed   $MIMEHeader = '' [line 141]

The complete compiled MIME message headers.

API Tags:
Access:  protected


[ Top ]
mixed   $Password = '' [line 267]

SMTP password.

API Tags:
Access:  public


[ Top ]
mixed   $PluginDir = '' [line 182]

Path to PHPMailer plugins.

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

API Tags:
Deprecated:  Should not be needed now there is an autoloader.
Access:  public


[ Top ]
mixed   $Port = 25 [line 231]

The default SMTP server port.

API Tags:
Access:  public

Information Tags:
TODO:  Why is this needed when the SMTP class takes care of it?

[ Top ]
mixed   $Priority = 3 [line 41]

Email priority.

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

API Tags:
Access:  public


[ Top ]
mixed   $Realm = '' [line 281]

SMTP realm.

Used for NTLM auth

API Tags:
Access:  public


[ Top ]
mixed   $ReplyTo = array() [line 464]

The array of reply-to names and addresses.

API Tags:
Access:  protected


[ Top ]
mixed   $ReturnPath = '' [line 95]

The Return-Path of the message.

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

API Tags:
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

Information Tags:
Link:  RFC5321 reference

[ Top ]
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.

API Tags:
Access:  public


[ Top ]
mixed   $Sendmail = '/usr/sbin/sendmail' [line 167]

The path to the sendmail program.

API Tags:
Access:  public


[ Top ]
mixed   $sign_cert_file = '' [line 528]

The S/MIME certificate file path.

API Tags:
Access:  protected


[ Top ]
mixed   $sign_key_file = '' [line 535]

The S/MIME key file path.

API Tags:
Access:  protected


[ Top ]
mixed   $sign_key_pass = '' [line 543]

The S/MIME password for the key.

Used only if the key is encrypted.

API Tags:
Access:  protected


[ Top ]
mixed   $SingleTo = false [line 339]

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

API Tags:
Access:  public


[ Top ]
mixed   $SingleToArray = array() [line 346]

Storage for addresses when SingleTo is enabled.

API Tags:
Access:  public

Information Tags:
TODO:  This should really not be public

[ Top ]
mixed   $smtp = null [line 436]

An instance of the SMTP sender class.

API Tags:
Access:  protected


[ Top ]
mixed   $SMTPAuth = false [line 255]

Whether to use SMTP authentication.

Uses the Username and Password properties.

API Tags:
See:  PHPMailer::$Username
See:  PHPMailer::$Password
Access:  public


[ Top ]
mixed   $SMTPDebug = 0 [line 308]

SMTP class debug output mode.

Debug output level. Options: * `0` No output * `1` Commands * `2` Data and commands * `3` As 2 plus connection status * `4` Low-level data output

API Tags:
See:  SMTP::$do_debug
Access:  public


[ Top ]
mixed   $SMTPKeepAlive = false [line 332]

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

API Tags:
Access:  public


[ Top ]
mixed   $SMTPSecure = '' [line 246]

The secure connection prefix.

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

API Tags:
Access:  public


[ Top ]
mixed   $Subject = '' [line 101]

The Subject of the message.

API Tags:
Access:  public


[ Top ]
mixed   $Timeout = 10 [line 294]

The SMTP server timeout in seconds.

API Tags:
Access:  public


[ Top ]
mixed   $to = array() [line 443]

The array of 'to' addresses.

API Tags:
Access:  protected


[ Top ]
mixed   $Username = '' [line 261]

SMTP username.

API Tags:
Access:  public


[ Top ]
mixed   $UseSendmailOptions = true [line 174]

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

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

API Tags:
Access:  public


[ Top ]
mixed   $Version = '5.2.9' [line 34]

The PHPMailer Version number.

API Tags:
Access:  public


[ Top ]
mixed   $WordWrap = 0 [line 154]

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

API Tags:
Access:  public


[ Top ]
mixed   $Workstation = '' [line 288]

SMTP workstation.

Used for NTLM auth

API Tags:
Access:  public


[ Top ]
mixed   $XMailer = '' [line 429]

What to use in the X-Mailer header.

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

API Tags:
Access:  public


[ Top ]
Methods
static method filenameToType  [line 3086]

  static string filenameToType( string $filename  )

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

API Tags:
Access:  public


[ Top ]
static method mb_pathinfo  [line 3108]

  static string|array mb_pathinfo( string $path, [integer|string $options = null]  )

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

API Tags:
Access:  public

Information Tags:
Link:  http://www.php.net/manual/en/function.pathinfo.php#107461

[ Top ]
static method normalizeBreaks  [line 3196]

  static string normalizeBreaks( string $text, [string $breaktype = "\r\n"]  )

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

API Tags:
Access:  public


[ Top ]
static method rfcDate  [line 2788]

  static string rfcDate( )

Return an RFC 822 formatted date.


API Tags:
Access:  public


[ Top ]
static method validateAddress  [line 873]

  static boolean validateAddress( string $address, [string $patternselect = 'auto']  )

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.

API Tags:
Access:  public


[ Top ]
static method _mime_types  [line 2984]

  static string _mime_types( [string $ext = '']  )

Get the MIME type for a file extension.

Parameters:
string   $ext:  File extension

API Tags:
Return:  MIME type of file.
Access:  public


[ Top ]
Constructor __construct  [line 576]

  PHPMailer __construct( [boolean $exceptions = false]  )

Constructor.

Parameters:
boolean   $exceptions:  Should we throw external exceptions?

API Tags:
Access:  public


[ Top ]
Destructor __destruct  [line 584]

  void __destruct( )

Destructor.


API Tags:
Access:  public


[ Top ]
addAddress  [line 732]

  boolean addAddress( string $address, [string $name = '']  )

Add a "To" address.

Parameters:
string   $address: 
string   $name: 

API Tags:
Return:  true on success, false if address already used
Access:  public


[ Top ]
addAnAddress  [line 782]

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

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: 

API Tags:
Return:  true on success, false if address already used or invalid in some way
Access:  protected

Information Tags:
Throws:  phpmailerException

[ Top ]
addAttachment  [line 2070]

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

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

API Tags:
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
addBCC  [line 756]

  boolean addBCC( string $address, [string $name = '']  )

Add a "BCC" address.

Parameters:
string   $address: 
string   $name: 

API Tags:
Return:  true on success, false if address already used
Access:  public


[ Top ]
addCC  [line 744]

  boolean addCC( string $address, [string $name = '']  )

Add a "CC" address.

Parameters:
string   $address: 
string   $name: 

API Tags:
Return:  true on success, false if address already used
Access:  public


[ Top ]
addCustomHeader  [line 2873]

  void addCustomHeader( string $name, [string $value = null]  )

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

API Tags:
Access:  public


[ Top ]
addEmbeddedImage  [line 2579]

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

Add an embedded (inline) attachment from a file.

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

API Tags:
Return:  True on successfully adding an attachment
Access:  public


[ Top ]
addrAppend  [line 1455]

  string addrAppend( string $type, array $addr  )

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

API Tags:
Access:  public


[ Top ]
addReplyTo  [line 767]

  boolean addReplyTo( string $address, [string $name = '']  )

Add a "Reply-to" address.

Parameters:
string   $address: 
string   $name: 

API Tags:
Access:  public


[ Top ]
addrFormat  [line 1471]

  string addrFormat( array $addr  )

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

API Tags:
Access:  public


[ Top ]
addStringAttachment  [line 2539]

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

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

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

Parameters:
string   $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

API Tags:
Access:  public


[ Top ]
addStringEmbeddedImage  [line 2624]

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

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

API Tags:
Return:  True on successfully adding an attachment
Access:  public


[ Top ]
alternativeExists  [line 2684]

  boolean alternativeExists( )

Check if this message has an alternative body set.


API Tags:
Access:  public


[ Top ]
attachAll  [line 2126]

  string attachAll( string $disposition_type, string $boundary  )

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

Returns an empty string on failure.

Parameters:
string   $disposition_type: 
string   $boundary: 

API Tags:
Access:  protected


[ Top ]
attachmentExists  [line 2670]

  boolean attachmentExists( )

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


API Tags:
Access:  public


[ Top ]
base64EncodeWrapMB  [line 2404]

  string base64EncodeWrapMB( string $str, [string $linebreak = null]  )

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

API Tags:
Access:  public

Information Tags:
Link:  http://www.php.net/manual/en/function.mb-encode-mimeheader.php#60283

[ Top ]
clearAddresses  [line 2693]

  void clearAddresses( )

Clear all To recipients.


API Tags:
Access:  public


[ Top ]
clearAllRecipients  [line 2738]

  void clearAllRecipients( )

Clear all recipient types.


API Tags:
Access:  public


[ Top ]
clearAttachments  [line 2750]

  void clearAttachments( )

Clear all filesystem, string, and binary attachments.


API Tags:
Access:  public


[ Top ]
clearBCCs  [line 2717]

  void clearBCCs( )

Clear all BCC recipients.


API Tags:
Access:  public


[ Top ]
clearCCs  [line 2705]

  void clearCCs( )

Clear all CC recipients.


API Tags:
Access:  public


[ Top ]
clearCustomHeaders  [line 2759]

  void clearCustomHeaders( )

Clear all custom headers.


API Tags:
Access:  public


[ Top ]
clearReplyTos  [line 2729]

  void clearReplyTos( )

Clear all ReplyTo recipients.


API Tags:
Access:  public


[ Top ]
createBody  [line 1812]

  string createBody( )

Assemble the message body.

Returns an empty string on failure.


API Tags:
Return:  The assembled message body
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
createHeader  [line 1643]

  string createHeader( )

Assemble message headers.


API Tags:
Return:  The assembled headers
Access:  public


[ Top ]
DKIM_Add  [line 3312]

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

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

Parameters:
string   $headers_line:  Header lines
string   $subject:  Subject
string   $body:  Body

API Tags:
Access:  public


[ Top ]
DKIM_BodyC  [line 3289]

  string DKIM_BodyC( string $body  )

Generate a DKIM canonicalization body.

Parameters:
string   $body:  Message Body

API Tags:
Access:  public


[ Top ]
DKIM_HeaderC  [line 3269]

  string DKIM_HeaderC( string $signHeader  )

Generate a DKIM canonicalization header.

Parameters:
string   $signHeader:  Header

API Tags:
Access:  public


[ Top ]
DKIM_QP  [line 3222]

  string DKIM_QP( string $txt  )

Quoted-Printable-encode a DKIM header.

Parameters:
string   $txt: 

API Tags:
Access:  public


[ Top ]
DKIM_Sign  [line 3243]

  string DKIM_Sign( string $signHeader  )

Generate a DKIM signature.

Parameters:
string   $signHeader: 

API Tags:
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
doCallback  [line 3430]

  void doCallback( boolean $isSent, array $to, array $cc, array $bcc, string $subject, string $body, string $from  )

Perform a callback.

Parameters:
boolean   $isSent: 
array   $to: 
array   $cc: 
array   $bcc: 
string   $subject: 
string   $body: 
string   $from: 

API Tags:
Access:  protected


[ Top ]
edebug  [line 627]

  void edebug( string $str  )

Output debugging info via user-defined method.

Only generates output if SMTP debug output is enabled (@see SMTP::$do_debug).

Parameters:
string   $str: 

API Tags:
See:  PHPMailer::$Debugoutput
See:  PHPMailer::$SMTPDebug
Access:  protected


[ Top ]
encodeFile  [line 2235]

  string encodeFile( string $path, [string $encoding = 'base64']  )

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'

API Tags:
See:  EncodeFile(encodeFile
Access:  protected

Information Tags:
Throws:  phpmailerException

[ Top ]
encodeHeader  [line 2312]

  string encodeHeader( string $str, [string $position = 'text']  )

Encode a header string optimally.

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

Parameters:
string   $str: 
string   $position: 

API Tags:
Access:  public


[ Top ]
encodeQ  [line 2487]

  string encodeQ( string $str, [string $position = 'text']  )

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

API Tags:
Access:  public

Information Tags:
Link:  http://tools.ietf.org/html/rfc2047

[ Top ]
encodeQP  [line 2446]

  string encodeQP( string $string, [integer $line_max = 76]  )

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

API Tags:
Access:  public

Information Tags:
Link:  Adapted from this comment

[ Top ]
encodeQPphp  [line 2471]

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

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

Parameters:
string   $string: 
integer   $line_max: 
boolean   $space_conv: 

API Tags:
See:  PHPMailer::encodeQP()
Deprecated:  Use encodeQP instead.
Access:  public


[ Top ]
encodeString  [line 2276]

  string encodeString( string $str, [string $encoding = 'base64']  )

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'

API Tags:
Access:  public


[ Top ]
endBoundary  [line 2006]

  string endBoundary( string $boundary  )

Return the end of a message boundary.

Parameters:
string   $boundary: 

API Tags:
Access:  protected


[ Top ]
fixEOL  [line 2853]

  string fixEOL( string $str  )

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

API Tags:
Access:  public


[ Top ]
getAllRecipientAddresses  [line 3415]

  array getAllRecipientAddresses( )

Allows for public read access to 'all_recipients' property.


API Tags:
Access:  public


[ Top ]
getAttachments  [line 2113]

  array getAttachments( )

Return the array of attachments.


API Tags:
Access:  public


[ Top ]
getBccAddresses  [line 3395]

  array getBccAddresses( )

Allows for public read access to 'bcc' property.


API Tags:
Access:  public


[ Top ]
getBoundary  [line 1976]

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

Return the start of a message boundary.

Parameters:
string   $boundary: 
string   $charSet: 
string   $contentType: 
string   $encoding: 

API Tags:
Access:  protected


[ Top ]
getCcAddresses  [line 3385]

  array getCcAddresses( )

Allows for public read access to 'cc' property.


API Tags:
Access:  public


[ Top ]
getLastMessageID  [line 854]

  string getLastMessageID( )

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.


API Tags:
Access:  public


[ Top ]
getMailMIME  [line 1744]

  string getMailMIME( )

Get the message MIME type headers.


API Tags:
Access:  public


[ Top ]
getReplyToAddresses  [line 3405]

  array getReplyToAddresses( )

Allows for public read access to 'ReplyTo' property.


API Tags:
Access:  public


[ Top ]
getSentMIMEMessage  [line 1799]

  string getSentMIMEMessage( )

Returns the whole MIME message.

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


API Tags:
See:  PHPMailer::preSend()
Access:  public


[ Top ]
getSMTPInstance  [line 1191]

  SMTP getSMTPInstance( )

Get an instance to use for SMTP operations.

Override this function to load your own SMTP implementation


API Tags:
Access:  public


[ Top ]
getToAddresses  [line 3375]

  array getToAddresses( )

Allows for public read access to 'to' property.


API Tags:
Access:  public


[ Top ]
getTranslations  [line 1440]

  array getTranslations( )

Get the array of strings for the current language.


API Tags:
Access:  public


[ Top ]
has8bitChars  [line 2389]

  boolean has8bitChars( string $text  )

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

Parameters:
string   $text: 

API Tags:
Access:  public


[ Top ]
hasMultiBytes  [line 2375]

  boolean hasMultiBytes( string $str  )

Check if a string contains multi-byte characters.

Parameters:
string   $str:  multi-byte text to wrap encode

API Tags:
Access:  public


[ Top ]
headerLine  [line 2043]

  string headerLine( string $name, string $value  )

Format a header line.

Parameters:
string   $name: 
string   $value: 

API Tags:
Access:  public


[ Top ]
html2text  [line 2963]

  string html2text( string $html, [boolean $advanced = false]  )

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?

API Tags:
Access:  public


[ Top ]
inlineImageExists  [line 2656]

  boolean inlineImageExists( )

Check if an inline attachment is present.


API Tags:
Access:  public


[ Top ]
isError  [line 2841]

  boolean isError( )

Check if an error occurred.


API Tags:
Return:  True if an error did occur.
Access:  public


[ Top ]
isHTML  [line 667]

  void isHTML( [boolean $isHtml = true]  )

Sets message type to HTML or plain.

Parameters:
boolean   $isHtml:  True for HTML mode.

API Tags:
Access:  public


[ Top ]
isMail  [line 689]

  void isMail( )

Send messages using PHP's mail() function.


API Tags:
Access:  public


[ Top ]
isQmail  [line 714]

  void isQmail( )

Send messages using qmail.


API Tags:
Access:  public


[ Top ]
isSendmail  [line 698]

  void isSendmail( )

Send messages using $Sendmail.


API Tags:
Access:  public


[ Top ]
isSMTP  [line 680]

  void isSMTP( )

Send messages using SMTP.


API Tags:
Access:  public


[ Top ]
lang  [line 2823]

  string lang( string $key  )

Get an error message in the current language.

Parameters:
string   $key: 

API Tags:
Access:  protected


[ Top ]
mailSend  [line 1150]

  boolean mailSend( string $header, string $body  )

Send mail using the PHP mail() function.

Parameters:
string   $header:  The message headers
string   $body:  The message body

API Tags:
Access:  protected

Information Tags:
Link:  http://www.php.net/manual/en/book.mail.php
Throws:  phpmailerException

[ Top ]
msgHTML  [line 2894]

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

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

API Tags:
Access:  public


[ Top ]
postSend  [line 1050]

  boolean postSend( )

Actually send a message.

Send the email via the selected mechanism


API Tags:
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
preSend  [line 982]

  boolean preSend( )

Prepare a message for sending.


API Tags:
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
secureHeader  [line 3181]

  string secureHeader( string $str  )

Strip newlines to prevent header injection.

Parameters:
string   $str: 

API Tags:
Access:  public


[ Top ]
send  [line 960]

  boolean send( )

Create a message and send it.

Uses the sending method specified by $Mailer.


API Tags:
Return:  false on error - See the ErrorInfo property for details of the error.
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
sendmailSend  [line 1089]

  boolean sendmailSend( string $header, string $body  )

Send mail using the $Sendmail program.

Parameters:
string   $header:  The message headers
string   $body:  The message body

API Tags:
See:  PHPMailer::$Sendmail
Access:  protected

Information Tags:
Throws:  phpmailerException

[ Top ]
serverHostname  [line 2802]

  string serverHostname( )

Get the server hostname.

Returns 'localhost.localdomain' if unknown.


API Tags:
Access:  protected


[ Top ]
set  [line 3158]

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

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

API Tags:
Access:  public

Information Tags:
TODO:  Should this not be using __set() magic function?
Throws:  phpmailerException

[ Top ]
setError  [line 2770]

  void setError( string $msg  )

Add an error message to the error container.

Parameters:
string   $msg: 

API Tags:
Access:  protected


[ Top ]
setFrom  [line 825]

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

Set the From and FromName properties.

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

API Tags:
Access:  public

Information Tags:
Throws:  phpmailerException

[ Top ]
setLanguage  [line 1393]

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

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)

API Tags:
Access:  public


[ Top ]
setMessageType  [line 2018]

  void setMessageType( )

Set the message type.

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


API Tags:
Access:  protected


[ Top ]
setWordWrap  [line 1619]

  void setWordWrap( )

Set the body wrapping.


API Tags:
Access:  public


[ Top ]
sign  [line 3209]

  void 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

API Tags:
Access:  public


[ Top ]
smtpClose  [line 1374]

  void smtpClose( )

Close the active SMTP session if one exists.


API Tags:
Access:  public


[ Top ]
smtpConnect  [line 1281]

  boolean smtpConnect( [array $options = array()]  )

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

API Tags:
Access:  public
Uses:  SMTP

Information Tags:
Throws:  phpmailerException

[ Top ]
smtpSend  [line 1211]

  boolean smtpSend( string $header, string $body  )

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

API Tags:
See:  PHPMailer::getSMTPInstance() to use a different class.
Access:  protected
Uses:  SMTP

Information Tags:
Throws:  phpmailerException

[ Top ]
textLine  [line 2054]

  string textLine( string $value  )

Return a formatted mail line.

Parameters:
string   $value: 

API Tags:
Access:  public


[ Top ]
utf8CharBoundary  [line 1581]

  integer utf8CharBoundary( string $encodedText, integer $maxLength  )

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

API Tags:
Access:  public


[ Top ]
wrapText  [line 1493]

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

Word-wrap message.

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

Parameters:
string   $message:  The message to wrap
integer   $length:  The line length to wrap to
boolean   $qp_mode:  Whether to run in Quoted-Printable mode

API Tags:
Access:  public


[ Top ]
Constants
CRLF = "\r\n" [line 570]

SMTP RFC standard line ending.


[ Top ]
STOP_CONTINUE = 1 [line 560]

Error severity: message, likely ok to continue processing.


[ Top ]
STOP_CRITICAL = 2 [line 565]

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


[ Top ]
STOP_MESSAGE = 0 [line 555]

Error severity: message only, continue processing.


[ Top ]

Documentation generated on Tue, 06 Oct 2015 06:11:16 +0000 by phpDocumentor 1.4.4