contenido\classes\class.phpmailer.php
Description: PHP email class Class for sending email using either sendmail, PHP mail() or SMTP. Methods are based upon the standard AspEmail(tm) classes.
Requirements:
- Author
- Brent R. Matzelle
- Con_php_req
- 5.0
- Copyright
- Brent R. Matzelle
- License
- LGPL, see LICENSE
- Package
- Contenido Backend classes
- Since
- file available since contenido release <= 4.6 {@internal created 2001 modified 2006-07-30, HerrB, changes for contenido modified 2008-06-30, Frederic Schneider, add security fix modified 2009-11-06, Murat Purc, Workaround for invoking deprecated function in PHP 5.3 $Id: class.phpmailer.php 1094 2009-11-06 01:22:13Z xmurrix $: }}
- Version
- 1.0.1
\PHPMailer
- Author
- Brent R. Matzelle
- Copyright
- 2001 - 2003 Brent R. Matzelle
Properties

string $AltBody = ""This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.
""Details- Type
- string

string $Body = ""This can be either an HTML or text body. If HTML then run IsHTML(true).
""Details- Type
- string

string $CharSet = "iso-8859-1""iso-8859-1"Details- Type
- string

string $ConfirmReadingTo = """"Details- Type
- string

string $ContentType = "text/plain""text/plain"Details- Type
- string

string $Encoding = "8bit"Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
"8bit"Details- Type
- string

string $From = "root@localhost""root@localhost"Details- Type
- string

string $FromName = "Root User""Root User"Details- Type
- string

$Helo = ""@var string
""Details- Type
- n/a

string $Host = "localhost"All hosts must be separated by a semicolon. 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.
"localhost"Details- Type
- string

string $Hostname = ""If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.
""Details- Type
- string

string $Mailer = "mail""mail"Details- Type
- string

string $PluginDir = ""This is now only useful if the SMTP class is in a different directory than the PHP include path.
""Details- Type
- string

bool $SMTPAuth = falseUtilizes the Username and Password variables.
falseDetails- Type
- bool

bool $SMTPKeepAlive = falseIf this is set to true then to close the connection requires an explicit call to SmtpClose().
falseDetails- Type
- bool

string $Sender = ""If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
""Details- Type
- string

string $Sendmail = "/usr/sbin/sendmail""/usr/sbin/sendmail"Details- Type
- string

int $Timeout = 10This function will not work with the win32 version.
10Details- Type
- int

int $WordWrap = 00Details- Type
- int
Methods

AddAddress(string $address, string $name = "") : voidAdds a "To" address.
| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddAttachment(string $path, string $name = "", string $encoding = "base64", string $type = "application/octet-stream") : boolAdds an attachment from a path on the filesystem.
Returns false if the file could not be found or accessed.
| Name | Type | Description |
|---|---|---|
| $path | string | Path to the attachment. |
| $name | string | Overrides the attachment name. |
| $encoding | string | File encoding (see $Encoding). |
| $type | string | File extension (MIME) type. |
| Type | Description |
|---|---|
| bool |

AddBCC(string $address, string $name = "") : voidAdds a "Bcc" address.
Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddCC(string $address, string $name = "") : voidAdds a "Cc" address.
Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddCustomHeader( $custom_header) : voidAdds a custom header.
| Name | Type | Description |
|---|---|---|
| $custom_header |

AddEmbeddedImage(string $path, string $cid, string $name = "", string $encoding = "base64", string $type = "application/octet-stream") : boolAdds 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".
| Name | Type | Description |
|---|---|---|
| $path | string | Path to the attachment. |
| $cid | string | Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form. |
| $name | string | Overrides the attachment name. |
| $encoding | string | File encoding (see $Encoding). |
| $type | string | File extension (MIME) type. |
| Type | Description |
|---|---|
| bool |

AddReplyTo(string $address, string $name = "") : voidAdds a "Reply-to" address.
| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddStringAttachment(string $string, string $filename, string $encoding = "base64", string $type = "application/octet-stream") : voidAdds 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.
| Name | Type | Description |
|---|---|---|
| $string | string | String attachment data. |
| $filename | string | Name of the attachment. |
| $encoding | string | File encoding (see $Encoding). |
| $type | string | File extension (MIME) type. |

AddrAppend( $type, $addr) : stringCreates recipient headers.
| Name | Type | Description |
|---|---|---|
| $type | ||
| $addr |
| Type | Description |
|---|---|
| string |
- Access
- private

AddrFormat( $addr) : stringFormats an address correctly.
| Name | Type | Description |
|---|---|---|
| $addr |
| Type | Description |
|---|---|
| string |
- Access
- private

AttachAll() : stringAttaches all fs, string, and binary attachments to the message.
Returns an empty string on failure.
| Type | Description |
|---|---|
| string |
- Access
- private

ClearAttachments() : voidClears all previously set filesystem, string, and binary attachments.
Returns void.

CreateBody() : stringAssembles the message body.
Returns an empty string on failure.
| Type | Description |
|---|---|
| string |
- Access
- private

EncodeFile( $path, $encoding = "base64") : stringEncodes attachment in requested format.
Returns an empty string on failure.
| Name | Type | Description |
|---|---|---|
| $path | ||
| $encoding |
| Type | Description |
|---|---|
| string |
- Access
- private

EncodeHeader( $str, $position = 'text') : stringEncode a header string to best of Q, B, quoted or none.
| Name | Type | Description |
|---|---|---|
| $str | ||
| $position |
| Type | Description |
|---|---|
| string |
- Access
- private

EncodeQ( $str, $position = "text") : stringEncode string to q encoding.
| Name | Type | Description |
|---|---|---|
| $str | ||
| $position |
| Type | Description |
|---|---|
| string |
- Access
- private

EncodeQP( $str) : stringEncode string to quoted-printable.
| Name | Type | Description |
|---|---|---|
| $str |
| Type | Description |
|---|---|
| string |
- Access
- private

EncodeString( $str, $encoding = "base64") : stringEncodes string to requested format.
Returns an empty string on failure.
| Name | Type | Description |
|---|---|---|
| $str | ||
| $encoding |
| Type | Description |
|---|---|
| string |
- Access
- private

EndBoundary( $boundary) : voidReturns the end of a message boundary.
| Name | Type | Description |
|---|---|---|
| $boundary |
- Access
- private

FixEOL( $str) : stringChanges every end of line from CR or LF to CRLF.
| Name | Type | Description |
|---|---|---|
| $str |
| Type | Description |
|---|---|
| string |
- Access
- private

GetBoundary( $boundary, $charSet, $contentType, $encoding) : voidReturns the start of a message boundary.
| Name | Type | Description |
|---|---|---|
| $boundary | ||
| $charSet | ||
| $contentType | ||
| $encoding |
- Access
- private

HeaderLine( $name, $value) : stringReturns a formatted header line.
| Name | Type | Description |
|---|---|---|
| $name | ||
| $value |
| Type | Description |
|---|---|
| string |
- Access
- private

InlineImageExists() : boolReturns true if an inline attachment is present.
| Type | Description |
|---|---|
| bool |
- Access
- private

MailSend( $header, $body) : boolSends mail using the PHP mail() function.
| Name | Type | Description |
|---|---|---|
| $header | ||
| $body |
| Type | Description |
|---|---|
| bool |
- Access
- private

RFCDate() : stringReturns the proper RFC 822 formatted date.
| Type | Description |
|---|---|
| string |
- Access
- private

Send() : boolCreates 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.
| Type | Description |
|---|---|
| bool |

SendmailSend( $header, $body) : boolSends mail using the $Sendmail program.
| Name | Type | Description |
|---|---|---|
| $header | ||
| $body |
| Type | Description |
|---|---|
| bool |
- Access
- private

ServerHostname() : stringReturns the server hostname or 'localhost.localdomain' if unknown.
| Type | Description |
|---|---|
| string |
- Access
- private

ServerVar( $varName) : mixedReturns the appropriate server variable.
Should work with both PHP 4.1.0+ as well as older versions. Returns an empty string if nothing is found.
| Name | Type | Description |
|---|---|---|
| $varName |
| Type | Description |
|---|---|
| mixed |
- Access
- private

SetError( $msg) : voidAdds the error message to the error container.
Returns void.
| Name | Type | Description |
|---|---|---|
| $msg |
- Access
- private

SmtpConnect() : boolInitiates a connection to an SMTP server.
Returns false if the operation failed.
| Type | Description |
|---|---|
| bool |
- Access
- private

SmtpSend( $header, $body) : boolSends mail via SMTP using PhpSMTP (Author: Chris Ryan).
Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
| Name | Type | Description |
|---|---|---|
| $header | ||
| $body |
| Type | Description |
|---|---|
| bool |
- Access
- private

TextLine( $value) : stringReturns a formatted mail line.
| Name | Type | Description |
|---|---|---|
| $value |
| Type | Description |
|---|---|
| string |
- Access
- private