contenido\classes\class.phpmailer.php

Show: PublicProtectedPrivateinherited
Table of Contents
Project: Contenido Content Management System

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

Package: PHPMailer
PHPMailer - PHP email transport class
Author
Brent R. Matzelle  
Copyright
2001 - 2003 Brent R. Matzelle  

Properties

>VPropertypublicstring $AltBody = ""
Sets the text-only body of the message.

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.

Default value""Details
Type
string
>VPropertypublicstring $Body = ""
Sets the Body of the message.

This can be either an HTML or text body. If HTML then run IsHTML(true).

Default value""Details
Type
string
>VPropertypublicstring $CharSet = "iso-8859-1"
Sets the CharSet of the message.
Default value"iso-8859-1"Details
Type
string
>VPropertypublicstring $ConfirmReadingTo = ""
Sets the email address that a reading confirmation will be sent.
Default value""Details
Type
string
>VPropertypublicstring $ContentType = "text/plain"
Sets the Content-type of the message.
Default value"text/plain"Details
Type
string
>VPropertypublic$CustomHeader = array()
Default valuearray()Details
Type
n/a
>VPropertypublicstring $Encoding = "8bit"
Sets the Encoding of the message.

Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".

Default value"8bit"Details
Type
string
>VPropertypublicstring $ErrorInfo = ""
Holds the most recent mailer error message.
Default value""Details
Type
string
>VPropertypublicstring $From = "root@localhost"
Sets the From email address for the message.
Default value"root@localhost"Details
Type
string
>VPropertypublicstring $FromName = "Root User"
Sets the From name of the message.
Default value"Root User"Details
Type
string
>VPropertypublic$Helo = ""
Sets the SMTP HELO of the message (Default is $Hostname).

@var string

Default value""Details
Type
n/a
>VPropertypublicstring $Host = "localhost"
Sets the SMTP hosts.

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.

Default value"localhost"Details
Type
string
>VPropertypublicstring $Hostname = ""
Sets 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'.

Default value""Details
Type
string
>VPropertypublic$LE = "\n"
Default value"\n"Details
Type
n/a
>VPropertypublicstring $Mailer = "mail"
Method to send mail: ("mail", "sendmail", or "smtp").
Default value"mail"Details
Type
string
>VPropertypublic$Password = ""
Sets SMTP password.

@var string

Default value""Details
Type
n/a
>VPropertypublicstring $PluginDir = ""
Path to PHPMailer plugins.

This is now only useful if the SMTP class is in a different directory than the PHP include path.

Default value""Details
Type
string
>VPropertypublic$Port = 25
Sets the default SMTP server port.

@var int

Default value25Details
Type
n/a
>VPropertypublicint $Priority = 3
Email priority (1 = High, 3 = Normal, 5 = low).
Default value3Details
Type
int
>VPropertypublic$ReplyTo = array()
Default valuearray()Details
Type
n/a
>VPropertypublicbool $SMTPAuth = false
Sets SMTP authentication.

Utilizes the Username and Password variables.

Default valuefalseDetails
Type
bool
>VPropertypublic$SMTPDebug = false
Sets SMTP class debugging on or off.

@var bool

Default valuefalseDetails
Type
n/a
>VPropertypublicbool $SMTPKeepAlive = false
Prevents the SMTP connection from being closed after each mail sending.

If this is set to true then to close the connection requires an explicit call to SmtpClose().

Default valuefalseDetails
Type
bool
>VPropertypublicstring $Sender = ""
Sets 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.

Default value""Details
Type
string
>VPropertypublicstring $Sendmail = "/usr/sbin/sendmail"
Sets the path of the sendmail program.
Default value"/usr/sbin/sendmail"Details
Type
string
>VPropertypublicstring $Subject = ""
Sets the Subject of the message.
Default value""Details
Type
string
>VPropertypublicint $Timeout = 10
Sets the SMTP server timeout in seconds.

This function will not work with the win32 version.

Default value10Details
Type
int
>VPropertypublic$Username = ""
Sets SMTP username.

@var string

Default value""Details
Type
n/a
>VPropertypublic$Version = "1.73"
Holds PHPMailer version.

@var string

Default value"1.73"Details
Type
n/a
>VPropertypublicint $WordWrap = 0
Sets word wrapping on the body of the message to a given number of characters.
Default value0Details
Type
int
>VPropertypublic$attachment = array()
Default valuearray()Details
Type
n/a
>VPropertypublic$bcc = array()
Default valuearray()Details
Type
n/a
>VPropertypublic$boundary = array()
Default valuearray()Details
Type
n/a
>VPropertypublic$cc = array()
Default valuearray()Details
Type
n/a
>VPropertypublic$error_count = 0
Default value0Details
Type
n/a
>VPropertypublic$message_type = ""
Default value""Details
Type
n/a
>VPropertypublic$smtp = NULL
Default valueNULLDetails
Type
n/a
>VPropertypublic$to = array()
Default valuearray()Details
Type
n/a

Methods

methodpublicAddAddress(string $address, string $name = "") : void

Adds a "To" address.

Parameters
NameTypeDescription
$addressstring
$namestring
methodpublicAddAttachment(string $path, string $name = "", string $encoding = "base64", string $type = "application/octet-stream") : bool

Adds an attachment from a path on the filesystem.

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

Parameters
NameTypeDescription
$pathstring

Path to the attachment.

$namestring

Overrides the attachment name.

$encodingstring

File encoding (see $Encoding).

$typestring

File extension (MIME) type.

Returns
TypeDescription
bool
methodpublicAddBCC(string $address, string $name = "") : void

Adds a "Bcc" address.

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

Parameters
NameTypeDescription
$addressstring
$namestring
methodpublicAddCC(string $address, string $name = "") : void

Adds a "Cc" address.

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

Parameters
NameTypeDescription
$addressstring
$namestring
methodpublicAddCustomHeader( $custom_header) : void

Adds a custom header.

Parameters
NameTypeDescription
$custom_header
methodpublicAddEmbeddedImage(string $path, string $cid, string $name = "", string $encoding = "base64", string $type = "application/octet-stream") : bool

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

Path to the attachment.

$cidstring

Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form.

$namestring

Overrides the attachment name.

$encodingstring

File encoding (see $Encoding).

$typestring

File extension (MIME) type.

Returns
TypeDescription
bool
methodpublicAddReplyTo(string $address, string $name = "") : void

Adds a "Reply-to" address.

Parameters
NameTypeDescription
$addressstring
$namestring
methodpublicAddStringAttachment(string $string, string $filename, string $encoding = "base64", string $type = "application/octet-stream") : void

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

String attachment data.

$filenamestring

Name of the attachment.

$encodingstring

File encoding (see $Encoding).

$typestring

File extension (MIME) type.

methodpublicAddrAppend( $type,  $addr) : string

Creates recipient headers.

Parameters
NameTypeDescription
$type
$addr
Returns
TypeDescription
string
Details
Access
private  
methodpublicAddrFormat( $addr) : string

Formats an address correctly.

Parameters
NameTypeDescription
$addr
Returns
TypeDescription
string
Details
Access
private  
methodpublicAttachAll() : string

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

Returns an empty string on failure.

Returns
TypeDescription
string
Details
Access
private  
methodpublicClearAddresses() : void

Clears all recipients assigned in the TO array.

Returns void.

methodpublicClearAllRecipients() : void

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

Returns void.

methodpublicClearAttachments() : void

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

Returns void.

methodpublicClearBCCs() : void

Clears all recipients assigned in the BCC array.

Returns void.

methodpublicClearCCs() : void

Clears all recipients assigned in the CC array.

Returns void.

methodpublicClearCustomHeaders() : void

Clears all custom headers.

Returns void.

methodpublicClearReplyTos() : void

Clears all recipients assigned in the ReplyTo array.

Returns void.

methodpublicCreateBody() : string

Assembles the message body.

Returns an empty string on failure.

Returns
TypeDescription
string
Details
Access
private  
methodpublicCreateHeader() : string

Assembles message header.

Returns
TypeDescription
string
Details
Access
private  
methodpublicEncodeFile( $path,  $encoding = "base64") : string

Encodes attachment in requested format.

Returns an empty string on failure.

Parameters
NameTypeDescription
$path
$encoding
Returns
TypeDescription
string
Details
Access
private  
methodpublicEncodeHeader( $str,  $position = 'text') : string

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

Parameters
NameTypeDescription
$str
$position
Returns
TypeDescription
string
Details
Access
private  
methodpublicEncodeQ( $str,  $position = "text") : string

Encode string to q encoding.

Parameters
NameTypeDescription
$str
$position
Returns
TypeDescription
string
Details
Access
private  
methodpublicEncodeQP( $str) : string

Encode string to quoted-printable.

Parameters
NameTypeDescription
$str
Returns
TypeDescription
string
Details
Access
private  
methodpublicEncodeString( $str,  $encoding = "base64") : string

Encodes string to requested format.

Returns an empty string on failure.

Parameters
NameTypeDescription
$str
$encoding
Returns
TypeDescription
string
Details
Access
private  
methodpublicEndBoundary( $boundary) : void

Returns the end of a message boundary.

Parameters
NameTypeDescription
$boundary
Details
Access
private  
methodpublicFixEOL( $str) : string

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

Parameters
NameTypeDescription
$str
Returns
TypeDescription
string
Details
Access
private  
methodpublicGetBoundary( $boundary,  $charSet,  $contentType,  $encoding) : void

Returns the start of a message boundary.

Parameters
NameTypeDescription
$boundary
$charSet
$contentType
$encoding
Details
Access
private  
methodpublicHeaderLine( $name,  $value) : string

Returns a formatted header line.

Parameters
NameTypeDescription
$name
$value
Returns
TypeDescription
string
Details
Access
private  
methodpublicInlineImageExists() : bool

Returns true if an inline attachment is present.

Returns
TypeDescription
bool
Details
Access
private  
methodpublicIsError() : bool

Returns true if an error occurred.

Returns
TypeDescription
bool
methodpublicIsHTML(bool $bool) : void

Sets message type to HTML.

Parameters
NameTypeDescription
$boolbool
methodpublicIsMail() : void

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

methodpublicIsQmail() : void

Sets Mailer to send message using the qmail MTA.

methodpublicIsSMTP() : void

Sets Mailer to send message using SMTP.

methodpublicIsSendmail() : void

Sets Mailer to send message using the $Sendmail program.

methodpublicMailSend( $header,  $body) : bool

Sends mail using the PHP mail() function.

Parameters
NameTypeDescription
$header
$body
Returns
TypeDescription
bool
Details
Access
private  
methodpublicRFCDate() : string

Returns the proper RFC 822 formatted date.

Returns
TypeDescription
string
Details
Access
private  
methodpublicSend() : bool

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
TypeDescription
bool
methodpublicSendmailSend( $header,  $body) : bool

Sends mail using the $Sendmail program.

Parameters
NameTypeDescription
$header
$body
Returns
TypeDescription
bool
Details
Access
private  
methodpublicServerHostname() : string

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

Returns
TypeDescription
string
Details
Access
private  
methodpublicServerVar( $varName) : mixed

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

Parameters
NameTypeDescription
$varName
Returns
TypeDescription
mixed
Details
Access
private  
methodpublicSetError( $msg) : void

Adds the error message to the error container.

Returns void.

Parameters
NameTypeDescription
$msg
Details
Access
private  
methodpublicSetMessageType() : void

Sets the message type.

Details
Access
private  
methodpublicSetWordWrap() : void

Set the body wrapping.

Details
Access
private  
methodpublicSmtpClose() : void

Closes the active SMTP session if one exists.

methodpublicSmtpConnect() : bool

Initiates a connection to an SMTP server.

Returns false if the operation failed.

Returns
TypeDescription
bool
Details
Access
private  
methodpublicSmtpSend( $header,  $body) : bool

Sends mail via SMTP using PhpSMTP (Author: Chris Ryan).

Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.

Parameters
NameTypeDescription
$header
$body
Returns
TypeDescription
bool
Details
Access
private  
methodpublicTextLine( $value) : string

Returns a formatted mail line.

Parameters
NameTypeDescription
$value
Returns
TypeDescription
string
Details
Access
private  
methodpublicWrapText( $message,  $length,  $qp_mode = false) : string

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

Original written by philippe.

Parameters
NameTypeDescription
$message
$length
$qp_mode
Returns
TypeDescription
string
Details
Access
private  
Documentation was generated by phpDocumentor 2.0.0a12.