Class PHPMailer

Description

PHPMailer - PHP email transport class

  • copyright: 2001 - 2003 Brent R. Matzelle
  • author: Brent R. Matzelle

Located in /shared/phpmailer/class.phpmailer.php (line 28)


	
			
Direct descendents
Class Description
C_mailer C_mailer - PHPMailer class extension
Variable Summary
string $AltBody
mixed $attachment
mixed $bcc
string $Body
mixed $boundary
mixed $cc
string $CharSet
string $ContentType
string $Encoding
string $ErrorInfo
mixed $error_count
string $From
string $FromName
string $Helo
string $Host
string $Hostname
mixed $language
mixed $LE
string $Mailer
string $Password
string $PluginDir
int $Port
int $Priority
mixed $ReplyTo
string $Sender
string $Sendmail
mixed $smtp
bool $SMTPAuth
bool $SMTPDebug
string $Subject
int $Timeout
mixed $to
string $Username
string $Version
int $WordWrap
Method Summary
void AddAddress (string $address, [string $name = ""])
bool AddAttachment (string $path, [string $name = ""], [string $encoding = "base64"], [string $type = "application/octet-stream"])
void AddBCC (string $address, [string $name = ""])
void AddCC (string $address, [string $name = ""])
void AddCustomHeader (mixed $custom_header)
bool AddEmbeddedImage (string $path, string $cid, [string $name = ""], [string $encoding = "base64"], [string $type = "application/octet-stream"])
string AddrAppend (mixed $type, mixed $addr)
void AddReplyTo (string $address, [string $name = ""])
string AddrFormat (mixed $addr)
void AddStringAttachment (string $string, string $filename, [string $encoding = "base64"], [string $type = "application/octet-stream"])
string AttachAll ()
void ClearAddresses ()
void ClearBCCs ()
void ClearCCs ()
void ClearReplyTos ()
string CreateBody ()
string CreateHeader ()
string EncodeFile (mixed $path, [mixed $encoding = "base64"])
string EncodeHeader (mixed $str, [mixed $position = 'text'])
string EncodeQ (mixed $str, [mixed $position = "text"])
string EncodeQP (mixed $str)
string EncodeString (mixed $str, [mixed $encoding = "base64"])
void EndBoundary (mixed $boundary)
string FixEOL (mixed $str)
void GetBoundary (mixed $boundary, mixed $charSet, mixed $contentType, mixed $encoding)
string HeaderLine (mixed $name, mixed $value)
bool IsError ()
void IsHTML (bool $bool)
void IsMail ()
void IsQmail ()
void IsSendmail ()
void IsSMTP ()
string Lang (mixed $key)
bool MailSend (mixed $header, mixed $body)
string RFCDate ()
bool Send ()
bool SendmailSend (mixed $header, mixed $body)
string ServerHostname ()
mixed ServerVar (mixed $varName)
void SetError (mixed $msg)
bool SetLanguage (string $lang_type, [string $lang_path = "language/"])
void SetMessageType ()
void SetWordWrap ()
void SmtpClose ()
bool SmtpConnect ()
bool SmtpSend (mixed $header, mixed $body)
string TextLine (mixed $value)
string WrapText (mixed $message, mixed $length, [mixed $qp_mode = false])
Variables
string $AltBody = "" (line 104)

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.

mixed $attachment = array() (line 225)
  • access: private
mixed $bcc = array() (line 223)
  • access: private
string $Body = "" (line 95)

Sets the Body of the message. This can be either an HTML or text body.

If HTML then run IsHTML(true).

mixed $boundary = array() (line 228)
  • access: private
mixed $cc = array() (line 222)
  • access: private
string $CharSet = "iso-8859-1" (line 44)

Sets the CharSet of the message.

string $ConfirmReadingTo = "" (line 142)

Sets the email address that a reading confirmation will be sent.

string $ContentType = "text/plain" (line 50)

Sets the Content-type of the message.

mixed $CustomHeader = array() (line 226)
  • access: private
string $Encoding = "8bit" (line 57)

Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".

string $ErrorInfo = "" (line 63)

Holds the most recent mailer error message.

mixed $error_count = 0 (line 230)
  • access: private
string $From = "root@localhost" (line 69)

Sets the From email address for the message.

string $FromName = "Root User" (line 75)

Sets the From name of the message.

string $Helo = "" (line 176)

Sets the SMTP HELO of the message (Default is $Hostname).

string $Host = "localhost" (line 164)

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.

string $Hostname = "" (line 150)

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

mixed $language = array() (line 229)
  • access: private

Redefined in descendants as:
mixed $LE = "\n" (line 231)
  • access: private
string $Mailer = "mail" (line 117)

Method to send mail: ("mail", "sendmail", or "smtp").

mixed $message_type = "" (line 227)
  • access: private
string $Password = "" (line 194)

Sets SMTP password.

string $PluginDir = "" (line 130)

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

int $Port = 25 (line 170)

Sets the default SMTP server port.

int $Priority = 3 (line 38)

Email priority (1 = High, 3 = Normal, 5 = low).

mixed $ReplyTo = array() (line 224)
  • access: private
string $Sender = "" (line 82)

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.

string $Sendmail = "/usr/sbin/sendmail" (line 123)

Sets the path of the sendmail program.

mixed $smtp = NULL (line 220)
  • access: private
bool $SMTPAuth = false (line 182)

Sets SMTP authentication. Utilizes the Username and Password variables.

bool $SMTPDebug = false (line 207)

Sets SMTP class debugging on or off.

bool $SMTPKeepAlive = false (line 215)

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

string $Subject = "" (line 88)

Sets the Subject of the message.

int $Timeout = 10 (line 201)

Sets the SMTP server timeout in seconds. This function will not work with the win32 version.

mixed $to = array() (line 221)
  • access: private
string $Username = "" (line 188)

Sets SMTP username.

string $Version = "1.73" (line 136)

Holds PHPMailer version.

int $WordWrap = 0 (line 111)

Sets word wrapping on the body of the message to a given number of characters.

Methods
AddAddress (line 294)

Adds a "To" address.

void AddAddress (string $address, [string $name = ""])
  • string $address
  • string $name
AddAttachment (line 1004)

Adds an attachment from a path on the filesystem.

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

bool AddAttachment (string $path, [string $name = ""], [string $encoding = "base64"], [string $type = "application/octet-stream"])
  • string $path: Path to the attachment.
  • string $name: Overrides the attachment name.
  • string $encoding: File encoding (see $Encoding).
  • string $type: File extension (MIME) type.
AddBCC (line 322)

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

void AddBCC (string $address, [string $name = ""])
  • string $address
  • string $name
AddCC (line 308)

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

void AddCC (string $address, [string $name = ""])
  • string $address
  • string $name
AddCustomHeader (line 1502)

Adds a custom header.

void AddCustomHeader (mixed $custom_header)
AddEmbeddedImage (line 1282)

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

bool AddEmbeddedImage (string $path, string $cid, [string $name = ""], [string $encoding = "base64"], [string $type = "application/octet-stream"])
  • 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.
AddrAppend (line 628)

Creates recipient headers.

  • access: private
string AddrAppend (mixed $type, mixed $addr)
AddReplyTo (line 334)

Adds a "Reply-to" address.

void AddReplyTo (string $address, [string $name = ""])
  • string $address
  • string $name
AddrFormat (line 646)

Formats an address correctly.

  • access: private
string AddrFormat (mixed $addr)
AddStringAttachment (line 1255)

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.

void AddStringAttachment (string $string, string $filename, [string $encoding = "base64"], [string $type = "application/octet-stream"])
  • string $string: String attachment data.
  • string $filename: Name of the attachment.
  • string $encoding: File encoding (see $Encoding).
  • string $type: File extension (MIME) type.
AttachAll (line 1035)

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

Returns an empty string on failure.

  • access: private
string AttachAll ()
ClearAddresses (line 1336)

Clears all recipients assigned in the TO array. Returns void.

void ClearAddresses ()
ClearAllRecipients (line 1369)

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

void ClearAllRecipients ()
ClearAttachments (line 1380)

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

void ClearAttachments ()
ClearBCCs (line 1352)

Clears all recipients assigned in the BCC array. Returns void.

void ClearBCCs ()
ClearCCs (line 1344)

Clears all recipients assigned in the CC array. Returns void.

void ClearCCs ()
ClearCustomHeaders (line 1388)

Clears all custom headers. Returns void.

void ClearCustomHeaders ()
ClearReplyTos (line 1360)

Clears all recipients assigned in the ReplyTo array. Returns void.

void ClearReplyTos ()
CreateBody (line 863)

Assembles the message body. Returns an empty string on failure.

  • access: private
string CreateBody ()
CreateHeader (line 765)

Assembles message header.

  • access: private
string CreateHeader ()
EncodeFile (line 1092)

Encodes attachment in requested format. Returns an empty string on failure.

  • access: private
string EncodeFile (mixed $path, [mixed $encoding = "base64"])
EncodeHeader (line 1145)

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

  • access: private
string EncodeHeader (mixed $str, [mixed $position = 'text'])
EncodeQ (line 1221)

Encode string to q encoding.

  • access: private
string EncodeQ (mixed $str, [mixed $position = "text"])
EncodeQP (line 1198)

Encode string to quoted-printable.

  • access: private
string EncodeQP (mixed $str)
EncodeString (line 1114)

Encodes string to requested format. Returns an empty string on failure.

  • access: private
string EncodeString (mixed $str, [mixed $encoding = "base64"])
EndBoundary (line 949)

Returns the end of a message boundary.

  • access: private
void EndBoundary (mixed $boundary)
FixEOL (line 1491)

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

  • access: private
string FixEOL (mixed $str)
GetBoundary (line 929)

Returns the start of a message boundary.

  • access: private
void GetBoundary (mixed $boundary, mixed $charSet, mixed $contentType, mixed $encoding)
HeaderLine (line 977)

Returns a formatted header line.

  • access: private
string HeaderLine (mixed $name, mixed $value)
InlineImageExists (line 1314)

Returns true if an inline attachment is present.

  • access: private
bool InlineImageExists ()
IsError (line 1482)

Returns true if an error occurred.

bool IsError ()
IsHTML (line 243)

Sets message type to HTML.

void IsHTML (bool $bool)
  • bool $bool
IsMail (line 262)

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

void IsMail ()
IsQmail (line 278)

Sets Mailer to send message using the qmail MTA.

void IsQmail ()
IsSendmail (line 270)

Sets Mailer to send message using the $Sendmail program.

void IsSendmail ()
IsSMTP (line 254)

Sets Mailer to send message using SMTP.

void IsSMTP ()
Lang (line 1468)

Returns a message in the appropriate language.

  • access: private
string Lang (mixed $key)

Redefined in descendants as:
MailSend (line 429)

Sends mail using the PHP mail() function.

  • access: private
bool MailSend (mixed $header, mixed $body)
RFCDate (line 1413)

Returns the proper RFC 822 formatted date.

  • access: private
string RFCDate ()
Send (line 351)

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.

bool Send ()
SendmailSend (line 399)

Sends mail using the $Sendmail program.

  • access: private
bool SendmailSend (mixed $header, mixed $body)
ServerHostname (line 1452)

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

  • access: private
string ServerHostname ()
ServerVar (line 1430)

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.

  • access: private
mixed ServerVar (mixed $varName)
SetError (line 1403)

Adds the error message to the error container.

Returns void.

  • access: private
void SetError (mixed $msg)

Redefined in descendants as:
SetLanguage (line 604)

Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.

  • access: public
bool SetLanguage (string $lang_type, [string $lang_path = "language/"])
  • string $lang_type: Type of language (e.g. Portuguese: "br")
  • string $lang_path: Path to the language file directory
SetMessageType (line 958)

Sets the message type.

  • access: private
void SetMessageType ()
SetWordWrap (line 743)

Set the body wrapping.

  • access: private
void SetWordWrap ()
SmtpClose (line 584)

Closes the active SMTP session if one exists.

void SmtpClose ()
SmtpConnect (line 534)

Initiates a connection to an SMTP server. Returns false if the operation failed.

  • access: private
bool SmtpConnect ()
SmtpSend (line 467)

Sends mail via SMTP using PhpSMTP (Author: Chris Ryan). Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.

  • access: private
bool SmtpSend (mixed $header, mixed $body)
TextLine (line 986)

Returns a formatted mail line.

  • access: private
string TextLine (mixed $value)
WrapText (line 665)

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

Original written by philippe.

  • access: private
string WrapText (mixed $message, mixed $length, [mixed $qp_mode = false])

Documentation generated on Fri, 24 Nov 2006 21:16:04 +0100 by phpDocumentor 1.3.0RC3