Class phpmailer

phpmailer

public class phpmailer

phpmailer - PHP email transport class


Field Summary
 string $AltBody
          Sets the text-only body of the message.
 string $Body
          Sets the Body of the message.
 string $CharSet
          Sets the CharSet of the message.
 string $ContentType
          Sets the Content-type of the message.
 string $Encoding
          Sets the Encoding of the message.
 string $ErrorInfo
          Holds the most recent mailer error message.
 string $From
          Sets the From email address for the message.
 string $FromName
          Sets the From name of the message.
 string $Helo
          Sets the SMTP HELO of the message.
 string $Host
          Sets the SMTP hosts.
 string $Mailer
          Method to send mail: ("mail", "sendmail", or "smtp").
 string $Password
          Sets SMTP password.
 int $Port
          Sets the default SMTP server port.
 int $Priority
          Email priority (1 = High, 3 = Normal, 5 = low).
 string $Sender
          Sets the Sender email of the message.
 string $Sendmail
          Sets the path of the sendmail program.
 bool $SMTPAuth
          Sets SMTP authentication.
 string $Subject
          Sets the Subject of the message.
 bool $UseMSMailHeaders
          Turns Microsoft mail client headers on and off.
 string $Username
          Sets SMTP username.
 string $Version
          Holds phpmailer version.
 int $WordWrap
          Sets word wrapping on the message.
 
Constructor Summary
phpmailer()
           
 
Method Summary
 void AddAddress(var $address, var $name)
          Adds a "To" address.
 bool AddAttachment(var $path, var $name, var $encoding, var $type)
          Adds an attachment from a path on the filesystem.
 void AddBCC(var $address, var $name)
          Adds a "Bcc" address.
 void AddCC(var $address, var $name)
          Adds a "Cc" address.
 void AddCustomHeader(var $custom_header)
          Adds a custom header.
 void AddReplyTo(var $address, var $name)
          Adds a "Reply-to" address.
 void AddStringAttachment(var $string, var $filename, var $encoding, var $type)
          Adds a string or binary attachment (non-filesystem) to the list.
 void ClearAddresses()
          Clears all recipients assigned in the TO array.
 void ClearAllRecipients()
          Clears all recipients assigned in the TO, CC and BCC array.
 void ClearAttachments()
          Clears all previously set filesystem, string, and binary attachments.
 void ClearBCCs()
          Clears all recipients assigned in the BCC array.
 void ClearCCs()
          Clears all recipients assigned in the CC array.
 void ClearCustomHeaders()
          Clears all custom headers.
 void ClearReplyTos()
          Clears all recipients assigned in the ReplyTo array.
 void IsHTML(var $bool)
          Sets message type to HTML.
 void IsMail()
          Sets Mailer to send message using PHP mail() function.
 void IsQmail()
          Sets Mailer to send message using the qmail MTA.
 void IsSendmail()
          Sets Mailer to send message using the $Sendmail program.
 void IsSMTP()
          Sets Mailer to send message using SMTP.
 bool Send()
          Creates message and assigns Mailer.
 

Field Detail

$Priority

public int $Priority
Email priority (1 = High, 3 = Normal, 5 = low). Default value is 3.

$CharSet

public string $CharSet
Sets the CharSet of the message. Default value is "iso-8859-1".

$ContentType

public string $ContentType
Sets the Content-type of the message. Default value is "text/plain".

$Encoding

public string $Encoding
Sets the Encoding of the message. Options for this are "8bit" (default), "7bit", "binary", "base64", and "quoted-printable".

$ErrorInfo

public string $ErrorInfo
Holds the most recent mailer error message. Default value is "".

$From

public string $From
Sets the From email address for the message. Default value is "root@localhost".

$FromName

public string $FromName
Sets the From name of the message. Default value is "Root User".

$Sender

public string $Sender
Sets the Sender email of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode. Default value is "".

$Subject

public string $Subject
Sets the Subject of the message. Default value is "".

$Body

public string $Body
Sets the Body of the message. This can be either an HTML or text body. If HTML then run IsHTML(true). Default value is "".

$AltBody

public string $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 is "".

$WordWrap

public int $WordWrap
Sets word wrapping on the message. Default value is 0 (off).

$Mailer

public string $Mailer
Method to send mail: ("mail", "sendmail", or "smtp"). Default value is "mail".

$Sendmail

public string $Sendmail
Sets the path of the sendmail program. Default value is "/usr/sbin/sendmail".

$UseMSMailHeaders

public bool $UseMSMailHeaders
Turns Microsoft mail client headers on and off. Useful mostly for older clients. Default value is false (off).

$Version

public string $Version
Holds phpmailer version.

$Host

public string $Host
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.domain.com:25;smtp2.domain.com"). Hosts will be tried in order. Default value is "localhost".

$Port

public int $Port
Sets the default SMTP server port. Default value is 25.

$Helo

public string $Helo
Sets the SMTP HELO of the message. Default value is "localhost.localdomain".

$SMTPAuth

public bool $SMTPAuth
Sets SMTP authentication. Utilizes the Username and Password variables. Default value is false (off).

$Username

public string $Username
Sets SMTP username. Default value is "".

$Password

public string $Password
Sets SMTP password. Default value is "".
Constructor Detail

phpmailer

public phpmailer()
Method Detail

IsHTML

public void IsHTML(var $bool)
Sets message type to HTML. Returns void.

IsSMTP

public void IsSMTP()
Sets Mailer to send message using SMTP. Returns void.

IsMail

public void IsMail()
Sets Mailer to send message using PHP mail() function. Returns void.

IsSendmail

public void IsSendmail()
Sets Mailer to send message using the $Sendmail program. Returns void.

IsQmail

public void IsQmail()
Sets Mailer to send message using the qmail MTA. Returns void.

AddAddress

public void AddAddress(var $address,
                       var $name)
Adds a "To" address. Returns void.
Parameters:
$name - Default Value: ""

AddCC

public void AddCC(var $address,
                  var $name)
Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. This is a PHP bug that has been submitted on http: * functions correctly. Returns void.
Parameters:
$name - Default Value: ""

AddBCC

public void AddBCC(var $address,
                   var $name)
Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer. This is a PHP bug that has been submitted on http: * functions correctly. Returns void.
Parameters:
$name - Default Value: ""

AddReplyTo

public void AddReplyTo(var $address,
                       var $name)
Adds a "Reply-to" address. Returns void.
Parameters:
$name - Default Value: ""

Send

public bool 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.

AddAttachment

public bool AddAttachment(var $path,
                          var $name,
                          var $encoding,
                          var $type)
Adds an attachment from a path on the filesystem. Checks if attachment is valid and then adds the attachment to the list. Returns false if the file could not be found or accessed.
Parameters:
$name - Default Value: ""
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"

AddStringAttachment

public void AddStringAttachment(var $string,
                                var $filename,
                                var $encoding,
                                var $type)
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:
$encoding - Default Value: "base64"
$type - Default Value: "application/octet-stream"

ClearAddresses

public void ClearAddresses()
Clears all recipients assigned in the TO array. Returns void.

ClearCCs

public void ClearCCs()
Clears all recipients assigned in the CC array. Returns void.

ClearBCCs

public void ClearBCCs()
Clears all recipients assigned in the BCC array. Returns void.

ClearReplyTos

public void ClearReplyTos()
Clears all recipients assigned in the ReplyTo array. Returns void.

ClearAllRecipients

public void ClearAllRecipients()
Clears all recipients assigned in the TO, CC and BCC array. Returns void.

ClearAttachments

public void ClearAttachments()
Clears all previously set filesystem, string, and binary attachments. Returns void.

ClearCustomHeaders

public void ClearCustomHeaders()
Clears all custom headers. Returns void.

AddCustomHeader

public void AddCustomHeader(var $custom_header)
Adds a custom header. Returns void.