CWIS Developer Documentation

- Home
- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
PHPMailer Class Reference

## Public Member Functions
| __construct ($exceptions=false)
| Constructor.
| IsHTML ($ishtml=true)
| Sets message type to HTML.
| IsSMTP ()
| Sets Mailer to send message using SMTP.
| IsMail ()
| Sets Mailer to send message using PHP mail() function.
| IsSendmail ()
| Sets Mailer to send message using the $Sendmail program.
| IsQmail ()
| Sets Mailer to send message using the qmail MTA.
| AddAddress ($address, $name= '')
| Adds a "To" address.
| AddCC ($address, $name= '')
| Adds a "Cc" address.
| AddBCC ($address, $name= '')
| Adds a "Bcc" address.
| AddReplyTo ($address, $name= '')
| Adds a "Reply-to" address.
| SetFrom ($address, $name= '', $auto=1)
| Set the From and FromName properties.
| Send ()
| Creates message and assigns Mailer.
| SmtpConnect ()
| Initiates a connection to an SMTP server.
| SmtpClose ()
| Closes the active SMTP session if one exists.
| SetLanguage ($langcode= 'en', $lang_path= 'language/')
| Sets the language for all class error messages.
| GetTranslations ()
| Return the current array of language strings.
| AddrAppend ($type, $addr)
| Creates recipient headers.
| AddrFormat ($addr)
| Formats an address correctly.
| WrapText ($message, $length, $qp_mode=false)
| Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
| UTF8CharBoundary ($encodedText, $maxLength)
| Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
| SetWordWrap ()
| Set the body wrapping.
| CreateHeader ()
| Assembles message header.
| GetMailMIME ()
| Returns the message MIME.
| GetSentMIMEMessage ()
| Returns the MIME message (headers and body).
| CreateBody ()
| Assembles the message body.
| HeaderLine ($name, $value)
| Returns a formatted header line.
| TextLine ($value)
| Returns a formatted mail line.
| AddAttachment ($path, $name= '', $encoding= 'base64', $type= 'application/octet-stream')
| Adds an attachment from a path on the filesystem.
| GetAttachments ()
| Return the current array of attachments.
| EncodeString ($str, $encoding= 'base64')
| Encodes string to requested format.
| EncodeHeader ($str, $position= 'text')
| Encode a header string to best (shortest) of Q, B, quoted or none.
| HasMultiBytes ($str)
| Checks if a string contains multibyte characters.
| Base64EncodeWrapMB ($str)
| Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
| EncodeQPphp ($input= '', $line_max=76, $space_conv=false)
| Encode string to quoted-printable.
| EncodeQP ($string, $line_max=76, $space_conv=false)
| Encode string to RFC2045 (6.7) quoted-printable format Uses a PHP5 stream filter to do the encoding about 64x faster than the old version Also results in same content as you started with after decoding.
| EncodeQ ($str, $position= 'text')
| Encode string to q encoding.
| AddStringAttachment ($string, $filename, $encoding= 'base64', $type= 'application/octet-stream')
| Adds a string or binary attachment (non-filesystem) to the list.
| AddEmbeddedImage ($path, $cid, $name= '', $encoding= 'base64', $type= 'application/octet-stream')
| Adds an embedded attachment.
| AddStringEmbeddedImage ($string, $cid, $filename= '', $encoding= 'base64', $type= 'application/octet-stream')
| InlineImageExists ()
| Returns true if an inline attachment is present.
| AttachmentExists ()
| AlternativeExists ()
| ClearAddresses ()
| Clears all recipients assigned in the TO array.
| ClearCCs ()
| Clears all recipients assigned in the CC array.
| ClearBCCs ()
| Clears all recipients assigned in the BCC array.
| ClearReplyTos ()
| Clears all recipients assigned in the ReplyTo array.
| ClearAllRecipients ()
| Clears all recipients assigned in the TO, CC and BCC array.
| ClearAttachments ()
| Clears all previously set filesystem, string, and binary attachments.
| ClearCustomHeaders ()
| Clears all custom headers.
| IsError ()
| Returns true if an error occurred.
| FixEOL ($str)
| Changes every end of line from CR or LF to CRLF.
| AddCustomHeader ($custom_header)
| Adds a custom header.
| MsgHTML ($message, $basedir= '')
| Evaluates the message and returns modifications for inline images and backgrounds public.
| set ($name, $value= '')
| Set (or reset) Class Objects (variables)
| SecureHeader ($str)
| Strips newlines to prevent header injection.
| Sign ($cert_filename, $key_filename, $key_pass)
| Set the private key file and password to sign the message.
| DKIM_QP ($txt)
| Set the private key file and password to sign the message.
| DKIM_Sign ($s)
| Generate DKIM signature.
| DKIM_HeaderC ($s)
| Generate DKIM Canonicalization Header.
| DKIM_BodyC ($body)
| Generate DKIM Canonicalization Body.
| DKIM_Add ($headers_line, $subject, $body)
| Create the DKIM header, body, as new header.

## Static Public Member Functions
static | ValidateAddress ($address)
| Check that a string looks roughly like an email address should Static so it can be used without instantiation Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator Conforms approximately to RFC2822 Original pattern found here.
static | RFCDate ()
| Returns the proper RFC 822 formatted date.
static | _mime_types ($ext= '')
| Gets the MIME type of the embedded or inline image.

## Public Attributes
| $Priority = 3
| $CharSet = 'iso-8859-1'
| $ContentType = 'text/plain'
| $Encoding = '8bit'
| $ErrorInfo = ''
| $From = 'root@localhost'
| $FromName = 'Root User'
| $Sender = ''
| $Subject = ''
| $Body = ''
| $AltBody = ''
| $WordWrap = 0
| $Mailer = 'mail'
| $Sendmail = '/usr/sbin/sendmail'
| $PluginDir = ''
| $ConfirmReadingTo = ''
| $Hostname = ''
| $MessageID = ''
| $Host = 'localhost'
| $Port = 25
| $Helo = ''
| $SMTPSecure = ''
| $SMTPAuth = false
| $Username = ''
| $Password = ''
| $Timeout = 10
| $SMTPDebug = false
| $SMTPKeepAlive = false
| $SingleTo = false
| $SingleToArray = array()
| $LE = "\n"
| $DKIM_selector = 'phpmailer'
| $DKIM_identity = ''
| $DKIM_passphrase = ''
| $DKIM_domain = ''
| $DKIM_private = ''
| $action_function = ''
| $Version = '5.2.1'
| $XMailer = ''
const | STOP_MESSAGE = 0
const | STOP_CONTINUE = 1
const | STOP_CRITICAL = 2

## Protected Member Functions
| AddAnAddress ($kind, $address, $name= '')
| Adds an address to one of the recipient arrays Addresses that have been added already return false, but do not throw exceptions.
| PreSend ()
| PostSend ()
| SendmailSend ($header, $body)
| Sends mail using the $Sendmail program.
| MailSend ($header, $body)
| Sends mail using the PHP mail() function.
| SmtpSend ($header, $body)
| Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
| GetBoundary ($boundary, $charSet, $contentType, $encoding)
| Returns the start of a message boundary.
| EndBoundary ($boundary)
| Returns the end of a message boundary.
| SetMessageType ()
| Sets the message type.
| AttachAll ($disposition_type, $boundary)
| Attaches all fs, string, and binary attachments to the message.
| EncodeFile ($path, $encoding= 'base64')
| Encodes attachment in requested format.
| SetError ($msg)
| Adds the error message to the error container.
| ServerHostname ()
| Returns the server hostname or 'localhost.localdomain' if unknown.
| Lang ($key)
| Returns a message in the appropriate language.
| doCallback ($isSent, $to, $cc, $bcc, $subject, $body)

## Protected Attributes
| $MIMEBody = ''
| $MIMEHeader = ''
| $SentMIMEMessage = ''
| $smtp = NULL
| $to = array()
| $cc = array()
| $bcc = array()
| $ReplyTo = array()
| $all_recipients = array()
| $attachment = array()
| $CustomHeader = array()
| $message_type = ''
| $boundary = array()
| $language = array()
| $error_count = 0
| $sign_cert_file = ''
| $sign_key_file = ''
| $sign_key_pass = ''
| $exceptions = false

## Detailed Description

Definition at line 40 of file class.phpmailer.php.

## Constructor & Destructor Documentation

PHPMailer::__construct | ( |  | $exceptions = `false` | ) |

Constructor.

Parameters

  boolean | $exceptions | Should we throw external exceptions?

Definition at line 372 of file class.phpmailer.php.

References $exceptions.

## Member Function Documentation

static PHPMailer::_mime_types | ( |  | $ext = `''` | ) |
| static

Gets the MIME type of the embedded or inline image.

Parameters

  string | File extension public

Returns
  string MIME type of ext

Definition at line 2253 of file class.phpmailer.php.

PHPMailer::AddAddress | ( |  | $address,
|  |  | $name = `''`
| ) |  |

Adds a "To" address.

Parameters

  string | $address |
  string | $name |

Returns
  boolean true on success, false if address already used

Definition at line 437 of file class.phpmailer.php.

References AddAnAddress().

PHPMailer::AddAnAddress | ( |  | $kind,
|  |  | $address,
|  |  | $name = `''`
| ) |  |
| protected

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

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

Definition at line 482 of file class.phpmailer.php.

References Lang(), and SetError().

Referenced by AddAddress(), AddBCC(), AddCC(), AddReplyTo(), and SetFrom().

Here is the caller graph for this function:

PHPMailer::AddAttachment | ( |  | $path,
|  |  | $name = `''`,
|  |  | $encoding = `'base64'`,
|  |  | $type = `'application/octet-stream'`
| ) |  |

Adds an attachment from a path on the filesystem.

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

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.

Returns
  bool

Definition at line 1510 of file class.phpmailer.php.

References Lang(), and SetError().

PHPMailer::AddBCC | ( |  | $address,
|  |  | $name = `''`
| ) |  |

Adds a "Bcc" address.

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

Parameters

  string | $address |
  string | $name |

Returns
  boolean true on success, false if address already used

Definition at line 459 of file class.phpmailer.php.

References AddAnAddress().

PHPMailer::AddCC | ( |  | $address,
|  |  | $name = `''`
| ) |  |

Adds a "Cc" address.

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

Parameters

  string | $address |
  string | $name |

Returns
  boolean true on success, false if address already used

Definition at line 448 of file class.phpmailer.php.

References AddAnAddress().

PHPMailer::AddCustomHeader | ( |  | $custom_header | ) |

Adds a custom header.

public

Returns
  void

Definition at line 2203 of file class.phpmailer.php.

PHPMailer::AddEmbeddedImage | ( |  | $path,
|  |  | $cid,
|  |  | $name = `''`,
|  |  | $encoding = `'base64'`,
|  |  | $type = `'application/octet-stream'`
| ) |  |

Adds an embedded attachment.

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

Parameters

  string | $path | Path to the attachment.
  string | $cid | Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form.
  string | $name | Overrides the attachment name.
  string | $encoding | File encoding (see $Encoding).
  string | $type | File extension (MIME) type.

Returns
  bool

Definition at line 1965 of file class.phpmailer.php.

References Lang(), and SetError().

Referenced by MsgHTML().

Here is the caller graph for this function:

PHPMailer::AddrAppend | ( |  | $type,
|  |  | $addr
| ) |  |

Creates recipient headers.

public

Returns
  string

Definition at line 991 of file class.phpmailer.php.

References $LE, and AddrFormat().

Referenced by CreateHeader(), and PreSend().

Here is the caller graph for this function:

PHPMailer::AddReplyTo | ( |  | $address,
|  |  | $name = `''`
| ) |  |

Adds a "Reply-to" address.

Parameters

  string | $address |
  string | $name |

Returns
  boolean

Definition at line 469 of file class.phpmailer.php.

References AddAnAddress().

PHPMailer::AddrFormat | ( |  | $addr | ) |

Formats an address correctly.

public

Returns
  string

Definition at line 1008 of file class.phpmailer.php.

References EncodeHeader(), and SecureHeader().

Referenced by AddrAppend(), CreateHeader(), and MailSend().

Here is the caller graph for this function:

PHPMailer::AddStringAttachment | ( |  | $string,
|  |  | $filename,
|  |  | $encoding = `'base64'`,
|  |  | $type = `'application/octet-stream'`
| ) |  |

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

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

Parameters

  string | $string | String attachment data.
  string | $filename | Name of the attachment.
  string | $encoding | File encoding (see $Encoding).
  string | $type | File extension (MIME) type.

Returns
  void

Definition at line 1938 of file class.phpmailer.php.

PHPMailer::AddStringEmbeddedImage | ( |  | $string,
|  |  | $cid,
|  |  | $filename = `''`,
|  |  | $encoding = `'base64'`,
|  |  | $type = `'application/octet-stream'`
| ) |  |

Definition at line 1992 of file class.phpmailer.php.

PHPMailer::AlternativeExists | ( |  | ) |

Definition at line 2029 of file class.phpmailer.php.

Referenced by SetMessageType().

Here is the caller graph for this function:

PHPMailer::AttachAll | ( |  | $disposition_type,
|  |  | $boundary
| ) |  |
| protected

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

Returns an empty string on failure. protected

Returns
  string

Definition at line 1560 of file class.phpmailer.php.

References $attachment, $boundary, EncodeFile(), EncodeHeader(), EncodeString(), IsError(), and SecureHeader().

Referenced by CreateBody().

Here is the caller graph for this function:

PHPMailer::AttachmentExists | ( |  | ) |

Definition at line 2020 of file class.phpmailer.php.

References $attachment.

Referenced by SetMessageType().

Here is the caller graph for this function:

PHPMailer::Base64EncodeWrapMB | ( |  | $str | ) |

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

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

Parameters

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

Returns
  string

Definition at line 1781 of file class.phpmailer.php.

References $LE.

Referenced by EncodeHeader().

Here is the caller graph for this function:

PHPMailer::ClearAddresses | ( |  | ) |

Clears all recipients assigned in the TO array.

Returns void.

Returns
  void

Definition at line 2041 of file class.phpmailer.php.

References $to.

PHPMailer::ClearAllRecipients | ( |  | ) |

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

Returns void.

Returns
  void

Definition at line 2083 of file class.phpmailer.php.

PHPMailer::ClearAttachments | ( |  | ) |

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

Returns void.

Returns
  void

Definition at line 2095 of file class.phpmailer.php.

PHPMailer::ClearBCCs | ( |  | ) |

Clears all recipients assigned in the BCC array.

Returns void.

Returns
  void

Definition at line 2063 of file class.phpmailer.php.

References $bcc.

PHPMailer::ClearCCs | ( |  | ) |

Clears all recipients assigned in the CC array.

Returns void.

Returns
  void

Definition at line 2052 of file class.phpmailer.php.

References $cc.

PHPMailer::ClearCustomHeaders | ( |  | ) |

Clears all custom headers.

Returns void.

Returns
  void

Definition at line 2103 of file class.phpmailer.php.

PHPMailer::ClearReplyTos | ( |  | ) |

Clears all recipients assigned in the ReplyTo array.

Returns void.

Returns
  void

Definition at line 2074 of file class.phpmailer.php.

PHPMailer::CreateBody | ( |  | ) |

Assembles the message body.

Returns an empty string on failure. public

Returns
  string The assembled message body

Definition at line 1304 of file class.phpmailer.php.

References $LE, AttachAll(), EncodeString(), EndBoundary(), GetBoundary(), GetMailMIME(), HeaderLine(), IsError(), Lang(), SetWordWrap(), and TextLine().

Referenced by PreSend().

Here is the caller graph for this function:

PHPMailer::CreateHeader | ( |  | ) |

Assembles message header.

public

Returns
  string The assembled header

Definition at line 1169 of file class.phpmailer.php.

References $FromName, AddrAppend(), AddrFormat(), EncodeHeader(), GetMailMIME(), HeaderLine(), SecureHeader(), and ServerHostname().

Referenced by PreSend().

Here is the caller graph for this function:

PHPMailer::DKIM_Add | ( |  | $headers_line,
|  |  | $subject,
|  |  | $body
| ) |  |

Create the DKIM header, body, as new header.

public

Parameters

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

Definition at line 2483 of file class.phpmailer.php.

References $to, DKIM_BodyC(), DKIM_HeaderC(), DKIM_QP(), and DKIM_Sign().

Referenced by PreSend().

Here is the caller graph for this function:

PHPMailer::DKIM_BodyC | ( |  | $body | ) |

Generate DKIM Canonicalization Body.

public

Parameters

  string | $body | Message Body

Definition at line 2463 of file class.phpmailer.php.

Referenced by DKIM_Add().

Here is the caller graph for this function:

PHPMailer::DKIM_HeaderC | ( |  | $s | ) |

Generate DKIM Canonicalization Header.

public

Parameters

  string | $s | Header

Definition at line 2444 of file class.phpmailer.php.

Referenced by DKIM_Add().

Here is the caller graph for this function:

PHPMailer::DKIM_QP | ( |  | $txt | ) |

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

public

Parameters

  string | $key_filename | Parameter File Name
  string | $key_pass | Password for private key

Definition at line 2406 of file class.phpmailer.php.

Referenced by DKIM_Add().

Here is the caller graph for this function:

PHPMailer::DKIM_Sign | ( |  | $s | ) |

Generate DKIM signature.

public

Parameters

  string | $s | Header

Definition at line 2426 of file class.phpmailer.php.

Referenced by DKIM_Add().

Here is the caller graph for this function:

PHPMailer::doCallback | ( |  | $isSent,
|  |  | $to,
|  |  | $cc,
|  |  | $bcc,
|  |  | $subject,
|  |  | $body
| ) |  |
| protected

Definition at line 2518 of file class.phpmailer.php.

References $bcc, $cc, and $to.

Referenced by MailSend(), SendmailSend(), and SmtpSend().

Here is the caller graph for this function:

PHPMailer::EncodeFile | ( |  | $path,
|  |  | $encoding = `'base64'`
| ) |  |
| protected

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

See Also
  EncodeFile() protected

Returns
  string

Definition at line 1631 of file class.phpmailer.php.

References EncodeString(), Lang(), and SetError().

Referenced by AttachAll().

Here is the caller graph for this function:

PHPMailer::EncodeHeader | ( |  | $str,
|  |  | $position = `'text'`
| ) |  |

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

public

Returns
  string

Definition at line 1704 of file class.phpmailer.php.

References Base64EncodeWrapMB(), EncodeQ(), HasMultiBytes(), and WrapText().

Referenced by AddrFormat(), AttachAll(), CreateHeader(), MailSend(), and PreSend().

Here is the caller graph for this function:

PHPMailer::EncodeQ | ( |  | $str,
|  |  | $position = `'text'`
| ) |  |

Encode string to q encoding.

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

Definition at line 1903 of file class.phpmailer.php.

Referenced by EncodeHeader().

Here is the caller graph for this function:

PHPMailer::EncodeQP | ( |  | $string,
|  |  | $line_max = `76`,
|  |  | $space_conv = `false`
| ) |  |

Encode string to RFC2045 (6.7) quoted-printable format Uses a PHP5 stream filter to do the encoding about 64x faster than the old version Also results in same content as you started with after decoding.

See Also
  EncodeQPphp() public

Parameters

  string | $string | the text to encode
  integer | $line_max | Number of chars allowed on a line before wrapping
  boolean | $space_conv | Dummy param for compatibility with existing EncodeQP function

Returns
  string

Author
  Marcus Bointon

Definition at line 1874 of file class.phpmailer.php.

References EncodeQPphp().

Referenced by EncodeString().

Here is the caller graph for this function:

PHPMailer::EncodeQPphp | ( |  | $input = `''`,
|  |  | $line_max = `76`,
|  |  | $space_conv = `false`
| ) |  |

Encode string to quoted-printable.

Only uses standard PHP, slow, but will always work public

Parameters

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

Returns
  string

Definition at line 1821 of file class.phpmailer.php.

Referenced by EncodeQP().

Here is the caller graph for this function:

PHPMailer::EncodeString | ( |  | $str,
|  |  | $encoding = `'base64'`
| ) |  |

Encodes string to 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' public

Returns
  string

Definition at line 1673 of file class.phpmailer.php.

References $LE, EncodeQP(), FixEOL(), Lang(), and SetError().

Referenced by AttachAll(), CreateBody(), and EncodeFile().

Here is the caller graph for this function:

PHPMailer::EndBoundary | ( |  | $boundary | ) |
| protected

Returns the end of a message boundary.

protected

Returns
  string

Definition at line 1460 of file class.phpmailer.php.

References $boundary, and $LE.

Referenced by CreateBody().

Here is the caller graph for this function:

PHPMailer::FixEOL | ( |  | $str | ) |

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

public

Returns
  string

Definition at line 2191 of file class.phpmailer.php.

Referenced by EncodeString(), and WrapText().

Here is the caller graph for this function:

PHPMailer::GetAttachments | ( |  | ) |

Return the current array of attachments.

Returns
  array

Definition at line 1550 of file class.phpmailer.php.

References $attachment.

PHPMailer::GetBoundary | ( |  | $boundary,
|  |  | $charSet,
|  |  | $contentType,
|  |  | $encoding
| ) |  |
| protected

Returns the start of a message boundary.

protected

Returns
  string

Definition at line 1435 of file class.phpmailer.php.

References $boundary, $CharSet, $ContentType, $Encoding, $LE, HeaderLine(), and TextLine().

Referenced by CreateBody().

Here is the caller graph for this function:

PHPMailer::GetMailMIME | ( |  | ) |

Returns the message MIME.

public

Returns
  string

Definition at line 1257 of file class.phpmailer.php.

References HeaderLine(), and TextLine().

Referenced by CreateBody(), and CreateHeader().

Here is the caller graph for this function:

PHPMailer::GetSentMIMEMessage | ( |  | ) |

Returns the MIME message (headers and body).

Only really valid post PreSend(). public

Returns
  string

Definition at line 1294 of file class.phpmailer.php.

References $SentMIMEMessage.

PHPMailer::GetTranslations | ( |  | ) |

Return the current array of language strings.

Returns
  array

Definition at line 978 of file class.phpmailer.php.

References $language.

PHPMailer::HasMultiBytes | ( |  | $str | ) |

Checks if a string contains multibyte characters.

public

Parameters

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

Returns
  bool

Definition at line 1765 of file class.phpmailer.php.

Referenced by EncodeHeader().

Here is the caller graph for this function:

PHPMailer::HeaderLine | ( |  | $name,
|  |  | $value
| ) |  |

Returns a formatted header line.

public

Returns
  string

Definition at line 1483 of file class.phpmailer.php.

References $LE.

Referenced by CreateBody(), CreateHeader(), GetBoundary(), GetMailMIME(), and PreSend().

Here is the caller graph for this function:

PHPMailer::InlineImageExists | ( |  | ) |

Returns true if an inline attachment is present.

public

Returns
  bool

Definition at line 2011 of file class.phpmailer.php.

References $attachment.

Referenced by SetMessageType().

Here is the caller graph for this function:

PHPMailer::IsError | ( |  | ) |

Returns true if an error occurred.

public

Returns
  bool

Definition at line 2182 of file class.phpmailer.php.

Referenced by AttachAll(), and CreateBody().

Here is the caller graph for this function:

PHPMailer::IsHTML | ( |  | $ishtml = `true` | ) |

Sets message type to HTML.

Parameters

  bool | $ishtml |

Returns
  void

Definition at line 381 of file class.phpmailer.php.

Referenced by MsgHTML().

Here is the caller graph for this function:

PHPMailer::IsMail | ( |  | ) |

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

Returns
  void

Definition at line 401 of file class.phpmailer.php.

PHPMailer::IsQmail | ( |  | ) |

Sets Mailer to send message using the qmail MTA.

Returns
  void

Definition at line 420 of file class.phpmailer.php.

PHPMailer::IsSendmail | ( |  | ) |

Sets Mailer to send message using the $Sendmail program.

Returns
  void

Definition at line 409 of file class.phpmailer.php.

PHPMailer::IsSMTP | ( |  | ) |

Sets Mailer to send message using SMTP.

Returns
  void

Definition at line 393 of file class.phpmailer.php.

PHPMailer::Lang | ( |  | $key | ) |
| protected

Returns a message in the appropriate language.

protected

Returns
  string

Definition at line 2165 of file class.phpmailer.php.

References SetLanguage().

Referenced by AddAnAddress(), AddAttachment(), AddEmbeddedImage(), CreateBody(), EncodeFile(), EncodeString(), MailSend(), PreSend(), SendmailSend(), set(), SetError(), SetFrom(), SmtpConnect(), and SmtpSend().

Here is the caller graph for this function:

PHPMailer::MailSend | ( |  | $header,
|  |  | $body
| ) |  |
| protected

Sends mail using the PHP mail() function.

Parameters

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

Returns
  bool

Definition at line 732 of file class.phpmailer.php.

References $to, AddrFormat(), doCallback(), EncodeHeader(), Lang(), and SecureHeader().

Referenced by PostSend().

Here is the caller graph for this function:

PHPMailer::MsgHTML | ( |  | $message,
|  |  | $basedir = `''`
| ) |  |

Evaluates the message and returns modifications for inline images and backgrounds public.

Returns
  $message

Definition at line 2212 of file class.phpmailer.php.

References AddEmbeddedImage(), and IsHTML().

PHPMailer::PostSend | ( |  | ) |
| protected

Definition at line 653 of file class.phpmailer.php.

References MailSend(), SendmailSend(), SetError(), and SmtpSend().

Referenced by Send().

Here is the caller graph for this function:

PHPMailer::PreSend | ( |  | ) |
| protected

Definition at line 599 of file class.phpmailer.php.

References $MIMEHeader, AddrAppend(), CreateBody(), CreateHeader(), DKIM_Add(), EncodeHeader(), HeaderLine(), Lang(), SecureHeader(), SetError(), and SetMessageType().

Referenced by Send().

Here is the caller graph for this function:

static PHPMailer::RFCDate | ( |  | ) |
| static

Returns the proper RFC 822 formatted date.

public

Returns
  string

Definition at line 2133 of file class.phpmailer.php.

PHPMailer::SecureHeader | ( |  | $str | ) |

Strips newlines to prevent header injection.

public

Parameters

  string | $str | String

Returns
  string

Definition at line 2380 of file class.phpmailer.php.

Referenced by AddrFormat(), AttachAll(), CreateHeader(), MailSend(), and PreSend().

Here is the caller graph for this function:

PHPMailer::Send | ( |  | ) |

Creates message and assigns Mailer.

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

Returns
  bool

Definition at line 585 of file class.phpmailer.php.

References PostSend(), PreSend(), and SetError().

PHPMailer::SendmailSend | ( |  | $header,
|  |  | $body
| ) |  |
| protected

Sends mail using the $Sendmail program.

Parameters

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

Returns
  bool

Definition at line 686 of file class.phpmailer.php.

References doCallback(), and Lang().

Referenced by PostSend().

Here is the caller graph for this function:

PHPMailer::ServerHostname | ( |  | ) |
| protected

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

protected

Returns
  string

Definition at line 2148 of file class.phpmailer.php.

References $Hostname.

Referenced by CreateHeader(), and SmtpConnect().

Here is the caller graph for this function:

PHPMailer::set | ( |  | $name,
|  |  | $value = `''`
| ) |  |

Set (or reset) Class Objects (variables)

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

public

Parameters

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

Todo:
  Should this not be using __set() magic function?

Definition at line 2358 of file class.phpmailer.php.

References Lang(), and SetError().

PHPMailer::SetError | ( |  | $msg | ) |
| protected

Adds the error message to the error container.

protected

Returns
  void

Definition at line 2116 of file class.phpmailer.php.

References Lang().

Referenced by AddAnAddress(), AddAttachment(), AddEmbeddedImage(), EncodeFile(), EncodeString(), PostSend(), PreSend(), Send(), set(), and SetFrom().

Here is the caller graph for this function:

PHPMailer::SetFrom | ( |  | $address,
|  |  | $name = `''`,
|  |  | $auto = `1`
| ) |  |

Set the From and FromName properties.

Parameters

  string | $address |
  string | $name |

Returns
  boolean

Definition at line 526 of file class.phpmailer.php.

References AddAnAddress(), Lang(), and SetError().

PHPMailer::SetLanguage | ( |  | $langcode = `'en'`,
|  |  | $lang_path = `'language/'`
| ) |  |

Sets the language for all class 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. Portuguese: "br")
  string | $lang_path | Path to the language file directory public

Definition at line 944 of file class.phpmailer.php.

References $PHPMAILER_LANG.

Referenced by Lang().

Here is the caller graph for this function:

PHPMailer::SetMessageType | ( |  | ) |
| protected

Sets the message type.

protected

Returns
  void

Definition at line 1469 of file class.phpmailer.php.

References AlternativeExists(), AttachmentExists(), and InlineImageExists().

Referenced by PreSend().

Here is the caller graph for this function:

PHPMailer::SetWordWrap | ( |  | ) |

Set the body wrapping.

public

Returns
  void

Definition at line 1146 of file class.phpmailer.php.

References WrapText().

Referenced by CreateBody().

Here is the caller graph for this function:

PHPMailer::Sign | ( |  | $cert_filename,
|  |  | $key_filename,
|  |  | $key_pass
| ) |  |

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

public

Parameters

  string | $key_filename | Parameter File Name
  string | $key_pass | Password for private key

Definition at line 2393 of file class.phpmailer.php.

PHPMailer::SmtpClose | ( |  | ) |

Closes the active SMTP session if one exists.

Returns
  void

Definition at line 928 of file class.phpmailer.php.

PHPMailer::SmtpConnect | ( |  | ) |

Initiates a connection to an SMTP server.

Returns false if the operation failed. SMTP public

Returns
  bool

Definition at line 864 of file class.phpmailer.php.

References $Port, $SMTPDebug, Lang(), and ServerHostname().

Referenced by SmtpSend().

Here is the caller graph for this function:

PHPMailer::SmtpSend | ( |  | $header,
|  |  | $body
| ) |  |
| protected

Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.

Parameters

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

Returns
  bool

Definition at line 793 of file class.phpmailer.php.

References $bcc, $cc, $to, doCallback(), Lang(), and SmtpConnect().

Referenced by PostSend().

Here is the caller graph for this function:

PHPMailer::TextLine | ( |  | $value | ) |

Returns a formatted mail line.

public

Returns
  string

Definition at line 1492 of file class.phpmailer.php.

References $LE.

Referenced by CreateBody(), GetBoundary(), and GetMailMIME().

Here is the caller graph for this function:

PHPMailer::UTF8CharBoundary | ( |  | $encodedText,
|  |  | $maxLength
| ) |  |

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

Original written by Colin Brown. public

Parameters

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

Returns
  int

Definition at line 1108 of file class.phpmailer.php.

Referenced by WrapText().

Here is the caller graph for this function:

static PHPMailer::ValidateAddress | ( |  | $address | ) |
| static

Check that a string looks roughly like an email address should Static so it can be used without instantiation Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator Conforms approximately to RFC2822 Original pattern found here.

Parameters

  string | $address | The email address to check

Returns
  boolean public

Definition at line 563 of file class.phpmailer.php.

PHPMailer::WrapText | ( |  | $message,
|  |  | $length,
|  |  | $qp_mode = `false`
| ) |  |

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

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 public

Returns
  string

Definition at line 1026 of file class.phpmailer.php.

References $LE, FixEOL(), and UTF8CharBoundary().

Referenced by EncodeHeader(), and SetWordWrap().

Here is the caller graph for this function:

## Member Data Documentation

PHPMailer::$action_function = ''

Definition at line 321 of file class.phpmailer.php.

PHPMailer::$all_recipients = array()
| protected

Definition at line 344 of file class.phpmailer.php.

PHPMailer::$AltBody = ''

Definition at line 116 of file class.phpmailer.php.

PHPMailer::$attachment = array()
| protected

Definition at line 345 of file class.phpmailer.php.

Referenced by AttachAll(), AttachmentExists(), GetAttachments(), and InlineImageExists().

PHPMailer::$bcc = array()
| protected

Definition at line 342 of file class.phpmailer.php.

Referenced by ClearBCCs(), doCallback(), and SmtpSend().

PHPMailer::$Body = ''

Definition at line 107 of file class.phpmailer.php.

PHPMailer::$boundary = array()
| protected

Definition at line 348 of file class.phpmailer.php.

Referenced by AttachAll(), EndBoundary(), and GetBoundary().

PHPMailer::$cc = array()
| protected

Definition at line 341 of file class.phpmailer.php.

Referenced by ClearCCs(), doCallback(), and SmtpSend().

PHPMailer::$CharSet = 'iso-8859-1'

Definition at line 56 of file class.phpmailer.php.

Referenced by GetBoundary().

PHPMailer::$ConfirmReadingTo = ''

Definition at line 169 of file class.phpmailer.php.

PHPMailer::$ContentType = 'text/plain'

Definition at line 62 of file class.phpmailer.php.

Referenced by GetBoundary().

PHPMailer::$CustomHeader = array()
| protected

Definition at line 346 of file class.phpmailer.php.

PHPMailer::$DKIM_domain = ''

Definition at line 301 of file class.phpmailer.php.

PHPMailer::$DKIM_identity = ''

Definition at line 288 of file class.phpmailer.php.

PHPMailer::$DKIM_passphrase = ''

Definition at line 294 of file class.phpmailer.php.

PHPMailer::$DKIM_private = ''

Definition at line 308 of file class.phpmailer.php.

PHPMailer::$DKIM_selector = 'phpmailer'

Definition at line 281 of file class.phpmailer.php.

PHPMailer::$Encoding = '8bit'

Definition at line 69 of file class.phpmailer.php.

Referenced by GetBoundary().

PHPMailer::$error_count = 0
| protected

Definition at line 350 of file class.phpmailer.php.

PHPMailer::$ErrorInfo = ''

Definition at line 75 of file class.phpmailer.php.

PHPMailer::$exceptions = false
| protected

Definition at line 354 of file class.phpmailer.php.

Referenced by __construct().

PHPMailer::$From = 'root@localhost'

Definition at line 81 of file class.phpmailer.php.

PHPMailer::$FromName = 'Root User'

Definition at line 87 of file class.phpmailer.php.

Referenced by CreateHeader().

PHPMailer::$Helo = ''

Definition at line 210 of file class.phpmailer.php.

PHPMailer::$Host = 'localhost'

Definition at line 198 of file class.phpmailer.php.

PHPMailer::$Hostname = ''

Definition at line 177 of file class.phpmailer.php.

Referenced by ServerHostname().

PHPMailer::$language = array()
| protected

Definition at line 349 of file class.phpmailer.php.

Referenced by GetTranslations().

PHPMailer::$LE = "\n"

Definition at line 275 of file class.phpmailer.php.

Referenced by AddrAppend(), Base64EncodeWrapMB(), CreateBody(), EncodeString(), EndBoundary(), GetBoundary(), HeaderLine(), TextLine(), and WrapText().

PHPMailer::$Mailer = 'mail'

Definition at line 150 of file class.phpmailer.php.

PHPMailer::$message_type = ''
| protected

Definition at line 347 of file class.phpmailer.php.

PHPMailer::$MessageID = ''

Definition at line 184 of file class.phpmailer.php.

PHPMailer::$MIMEBody = ''
| protected

Definition at line 123 of file class.phpmailer.php.

PHPMailer::$MIMEHeader = ''
| protected

Definition at line 130 of file class.phpmailer.php.

Referenced by PreSend().

PHPMailer::$Password = ''

Definition at line 235 of file class.phpmailer.php.

PHPMailer::$PluginDir = ''

Definition at line 163 of file class.phpmailer.php.

PHPMailer::$Port = 25

Definition at line 204 of file class.phpmailer.php.

Referenced by SmtpConnect().

PHPMailer::$Priority = 3

Definition at line 50 of file class.phpmailer.php.

PHPMailer::$ReplyTo = array()
| protected

Definition at line 343 of file class.phpmailer.php.

PHPMailer::$Sender = ''

Definition at line 94 of file class.phpmailer.php.

PHPMailer::$Sendmail = '/usr/sbin/sendmail'

Definition at line 156 of file class.phpmailer.php.

PHPMailer::$SentMIMEMessage = ''
| protected

Definition at line 137 of file class.phpmailer.php.

Referenced by GetSentMIMEMessage().

PHPMailer::$sign_cert_file = ''
| protected

Definition at line 351 of file class.phpmailer.php.

PHPMailer::$sign_key_file = ''
| protected

Definition at line 352 of file class.phpmailer.php.

PHPMailer::$sign_key_pass = ''
| protected

Definition at line 353 of file class.phpmailer.php.

PHPMailer::$SingleTo = false

Definition at line 263 of file class.phpmailer.php.

PHPMailer::$SingleToArray = array()

Definition at line 269 of file class.phpmailer.php.

PHPMailer::$smtp = NULL
| protected

Definition at line 339 of file class.phpmailer.php.

PHPMailer::$SMTPAuth = false

Definition at line 223 of file class.phpmailer.php.

PHPMailer::$SMTPDebug = false

Definition at line 248 of file class.phpmailer.php.

Referenced by SmtpConnect().

PHPMailer::$SMTPKeepAlive = false

Definition at line 256 of file class.phpmailer.php.

PHPMailer::$SMTPSecure = ''

Definition at line 217 of file class.phpmailer.php.

PHPMailer::$Subject = ''

Definition at line 100 of file class.phpmailer.php.

PHPMailer::$Timeout = 10

Definition at line 242 of file class.phpmailer.php.

PHPMailer::$to = array()
| protected

Definition at line 340 of file class.phpmailer.php.

Referenced by ClearAddresses(), DKIM_Add(), doCallback(), MailSend(), and SmtpSend().

PHPMailer::$Username = ''

Definition at line 229 of file class.phpmailer.php.

PHPMailer::$Version = '5.2.1'

Definition at line 327 of file class.phpmailer.php.

PHPMailer::$WordWrap = 0

Definition at line 144 of file class.phpmailer.php.

PHPMailer::$XMailer = ''

Definition at line 333 of file class.phpmailer.php.

const PHPMailer::STOP_CONTINUE = 1

Definition at line 361 of file class.phpmailer.php.

const PHPMailer::STOP_CRITICAL = 2

Definition at line 362 of file class.phpmailer.php.

const PHPMailer::STOP_MESSAGE = 0

Definition at line 360 of file class.phpmailer.php.

The documentation for this class was generated from the following file:

- lib/PHPMailer/class.phpmailer.php