[ class tree: plugins ] [ index: plugins ] [ all elements ]

Class: PHPMailer

Source Location: /zp-extensions/PHPMailer/class.phpmailer.php

Class PHPMailer

Property Summary
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.
string   $Body   Sets the Body of the message. This can be either an HTML or text body.
string   $CharSet   Sets the CharSet of the message.
string   $ConfirmReadingTo   Sets the email address that a reading confirmation will be sent.
string   $ContentType   Sets the Content-type of the message.
string   $Encoding   Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
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 (Default is $Hostname).
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.example.com:25;smtp2.example.com").
string   $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'.
string   $Mailer   Method to send mail: ("mail", "sendmail", or "smtp").
string   $MessageID   Sets the message ID to be used in the Message-Id header.
string   $Password   Sets SMTP password.
string   $PluginDir   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   Sets the default SMTP server port.
int   $Priority   Email priority (1 = High, 3 = Normal, 5 = low).
string   $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.
string   $Sendmail   Sets the path of the sendmail program.
bool   $SingleTo   Provides the ability to have the TO field process individual
bool   $SMTPAuth   Sets SMTP authentication. Utilizes the Username and Password variables.
bool   $SMTPDebug   Sets SMTP class debugging on or off.
bool   $SMTPKeepAlive   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   $SMTPSecure   Sets connection prefix.
string   $Subject   Sets the Subject of the message.
int   $Timeout   Sets the SMTP server timeout in seconds. This function will not work with the win32 version.
string   $Username   Sets SMTP username.
string   $Version   Holds PHPMailer version.
int   $WordWrap   Sets word wrapping on the body of the message to a given number of characters.

[ Top ]
Method Summary
void   AddAddress()   Adds a "To" address.
bool   AddAttachment()   Adds an attachment from a path on the filesystem.
void   AddBCC()   Adds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
void   AddCC()   Adds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
void   AddCustomHeader()   Adds a custom header.
bool   AddEmbeddedImage()   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".
string   AddrAppend()   Creates recipient headers.
void   AddReplyTo()   Adds a "Reply-to" address.
string   AddrFormat()   Formats an address correctly.
void   AddStringAttachment()   Adds a string or binary attachment (non-filesystem) to the list.
string   AttachAll()   Attaches all fs, string, and binary attachments to the message.
string   Base64EncodeWrapMB()   Correctly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
void   ClearAddresses()   Clears all recipients assigned in the TO array. Returns void.
void   ClearAllRecipients()   Clears all recipients assigned in the TO, CC and BCC array. Returns void.
void   ClearAttachments()   Clears all previously set filesystem, string, and binary attachments. Returns void.
void   ClearBCCs()   Clears all recipients assigned in the BCC array. Returns void.
void   ClearCCs()   Clears all recipients assigned in the CC array. Returns void.
void   ClearCustomHeaders()   Clears all custom headers. Returns void.
void   ClearReplyTos()   Clears all recipients assigned in the ReplyTo array. Returns void.
string   CreateBody()   Assembles the message body. Returns an empty string on failure.
string   CreateHeader()   Assembles message header.
string   EncodeFile()   Encodes attachment in requested format. Returns an empty string on failure.
string   EncodeHeader()   Encode a header string to best of Q, B, quoted or none.
string   EncodeQ()   Encode string to q encoding.
string   EncodeQP()   Encode string to quoted-printable.
string   EncodeString()   Encodes string to requested format. Returns an empty string on failure.
void   EndBoundary()   Returns the end of a message boundary.
void   GetBoundary()   Returns the start of a message boundary.
void   getFile()   Read a file from a supplied filename and return it.
string   GetMailMIME()   Returns the message MIME.
bool   HasMultiBytes()   Checks if a string contains multibyte characters.
void   HeaderLine()  
bool   InlineImageExists()   Returns true if an inline attachment is present.
bool   IsError()   Returns true if an error occurred.
void   IsHTML()   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   MailSend()   Sends mail using the PHP mail() function.
$message   MsgHTML()   Evaluates the message and returns modifications for inline images and backgrounds
string   SecureHeader()   Strips newlines to prevent header injection.
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.
bool   SendmailSend()   Sends mail using the $Sendmail program.
void   set()   Set (or reset) Class Objects (variables)
bool   SetLanguage()   Sets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.
void   SetMessageType()   Sets the message type.
void   SetWordWrap()   Set the body wrapping.
void   Sign()   Set the private key file and password to sign the message.
void   SmtpClose()   Closes the active SMTP session if one exists.
bool   SmtpConnect()   Initiates a connection to an SMTP server. Returns false if the operation failed.
bool   SmtpSend()   Sends mail via SMTP using PhpSMTP (Author: Chris Ryan). Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
string   TextLine()   Returns a formatted mail line.
int   UTF8CharBoundary()   Finds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
string   WrapText()   Wraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
mime   _mime_types()   Gets the mime type of the embedded or inline image

[ Top ]
Properties
string   $AltBody = '' [line 115]

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.

API Tags:
Access:  public


[ Top ]
string   $Body = '' [line 106]

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

If HTML then run IsHTML(true).

API Tags:
Access:  public


[ Top ]
string   $CharSet = 'iso-8859-1' [line 55]

Sets the CharSet of the message.

API Tags:
Access:  public


[ Top ]
string   $ConfirmReadingTo = '' [line 153]

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

API Tags:
Access:  public


[ Top ]
string   $ContentType = 'text/plain' [line 61]

Sets the Content-type of the message.

API Tags:
Access:  public


[ Top ]
string   $Encoding = '8bit' [line 68]

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

API Tags:
Access:  public


[ Top ]
string   $ErrorInfo = '' [line 74]

Holds the most recent mailer error message.

API Tags:
Access:  public


[ Top ]
string   $From = 'root@localhost' [line 80]

Sets the From email address for the message.

API Tags:
Access:  public


[ Top ]
string   $FromName = 'Root User' [line 86]

Sets the From name of the message.

API Tags:
Access:  public


[ Top ]
string   $Helo = '' [line 194]

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

API Tags:
Access:  public


[ Top ]
string   $Host = 'localhost' [line 182]

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.

API Tags:
Access:  public


[ Top ]
string   $Hostname = '' [line 161]

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

API Tags:
Access:  public


[ Top ]
string   $Mailer = 'mail' [line 128]

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

API Tags:
Access:  public


[ Top ]
string   $MessageID = '' [line 168]

Sets the message ID to be used in the Message-Id header.

If empty, a unique id will be generated.

API Tags:
Access:  public


[ Top ]
string   $Password = '' [line 219]

Sets SMTP password.

API Tags:
Access:  public


[ Top ]
string   $PluginDir = '' [line 141]

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

API Tags:
Access:  public


[ Top ]
int   $Port = 25 [line 188]

Sets the default SMTP server port.

API Tags:
Access:  public


[ Top ]
int   $Priority = 3 [line 49]

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

API Tags:
Access:  public


[ Top ]
string   $Sender = '' [line 93]

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.

API Tags:
Access:  public


[ Top ]
string   $Sendmail = '/usr/sbin/sendmail' [line 134]

Sets the path of the sendmail program.

API Tags:
Access:  public


[ Top ]
bool   $SingleTo = false [line 247]

Provides the ability to have the TO field process individual

emails, instead of sending to entire TO addresses

API Tags:
Access:  public


[ Top ]
bool   $SMTPAuth = false [line 207]

Sets SMTP authentication. Utilizes the Username and Password variables.

API Tags:
Access:  public


[ Top ]
bool   $SMTPDebug = false [line 232]

Sets SMTP class debugging on or off.

API Tags:
Access:  public


[ Top ]
bool   $SMTPKeepAlive = false [line 240]

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

API Tags:
Access:  public


[ Top ]
string   $SMTPSecure = "" [line 201]

Sets connection prefix.

Options are "", "ssl" or "tls"

API Tags:
Access:  public


[ Top ]
string   $Subject = '' [line 99]

Sets the Subject of the message.

API Tags:
Access:  public


[ Top ]
int   $Timeout = 10 [line 226]

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

API Tags:
Access:  public


[ Top ]
string   $Username = '' [line 213]

Sets SMTP username.

API Tags:
Access:  public


[ Top ]
string   $Version = "2.2" [line 147]

Holds PHPMailer version.

API Tags:
Access:  public


[ Top ]
int   $WordWrap = 0 [line 122]

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

API Tags:
Access:  public


[ Top ]
Methods
AddAddress  [line 329]

  void AddAddress( string $address, [string $name = '']  )

Adds a "To" address.

Parameters:
string   $address: 
string   $name: 

API Tags:
Access:  public


[ Top ]
AddAttachment  [line 1129]

  bool AddAttachment( string $path, [string $name = ''], [string $encoding = 'base64'], [string $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.

API Tags:
Access:  public


[ Top ]
AddBCC  [line 357]

  void AddBCC( string $address, [string $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: 

API Tags:
Access:  public


[ Top ]
AddCC  [line 343]

  void AddCC( string $address, [string $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: 

API Tags:
Access:  public


[ Top ]
AddCustomHeader  [line 1695]

  void AddCustomHeader( $custom_header  )

Adds a custom header.

Parameters:
   $custom_header: 

API Tags:
Access:  public


[ Top ]
AddEmbeddedImage  [line 1498]

  bool AddEmbeddedImage( string $path, string $cid, [string $name = ''], [string $encoding = 'base64'], [string $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.

API Tags:
Access:  public


[ Top ]
AddrAppend  [line 683]

  string AddrAppend( $type, $addr  )

Creates recipient headers.

Parameters:
   $type: 
   $addr: 

API Tags:
Access:  public


[ Top ]
AddReplyTo  [line 369]

  void AddReplyTo( string $address, [string $name = '']  )

Adds a "Reply-to" address.

Parameters:
string   $address: 
string   $name: 

API Tags:
Access:  public


[ Top ]
AddrFormat  [line 701]

  string AddrFormat( $addr  )

Formats an address correctly.

Parameters:
   $addr: 

API Tags:
Access:  public


[ Top ]
AddStringAttachment  [line 1472]

  void AddStringAttachment( string $string, string $filename, [string $encoding = 'base64'], [string $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.

API Tags:
Access:  public


[ Top ]
AttachAll  [line 1159]

  string AttachAll( )

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

Returns an empty string on failure.


API Tags:
Access:  public


[ Top ]
Base64EncodeWrapMB  [line 1353]

  string Base64EncodeWrapMB( string $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

Parameters:
string   $str:  multi-byte text to wrap encode

API Tags:
Access:  public


[ Top ]
ClearAddresses  [line 1549]

  void ClearAddresses( )

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


API Tags:
Access:  public


[ Top ]
ClearAllRecipients  [line 1582]

  void ClearAllRecipients( )

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


API Tags:
Access:  public


[ Top ]
ClearAttachments  [line 1593]

  void ClearAttachments( )

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


API Tags:
Access:  public


[ Top ]
ClearBCCs  [line 1565]

  void ClearBCCs( )

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


API Tags:
Access:  public


[ Top ]
ClearCCs  [line 1557]

  void ClearCCs( )

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


API Tags:
Access:  public


[ Top ]
ClearCustomHeaders  [line 1601]

  void ClearCustomHeaders( )

Clears all custom headers. Returns void.


API Tags:
Access:  public


[ Top ]
ClearReplyTos  [line 1573]

  void ClearReplyTos( )

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


API Tags:
Access:  public


[ Top ]
CreateBody  [line 975]

  string CreateBody( )

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


API Tags:
Access:  public


[ Top ]
CreateHeader  [line 860]

  string CreateHeader( )

Assembles message header.


API Tags:
Access:  public


[ Top ]
EncodeFile  [line 1219]

  string EncodeFile( $path, [ $encoding = 'base64']  )

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

Parameters:
   $path: 
   $encoding: 

API Tags:
Access:  public


[ Top ]
EncodeHeader  [line 1276]

  string EncodeHeader( $str, [ $position = 'text']  )

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

Parameters:
   $str: 
   $position: 

API Tags:
Access:  public


[ Top ]
EncodeQ  [line 1438]

  string EncodeQ( $str, [ $position = 'text']  )

Encode string to q encoding.

Parameters:
   $str: 
   $position: 

API Tags:
Access:  public


[ Top ]
EncodeQP  [line 1392]

  string EncodeQP( [ $input = ''], [integer $line_max = 76], [ $space_conv = false], string $string  )

Encode string to quoted-printable.

Parameters:
string   $string:  the text to encode
integer   $line_max:  Number of chars allowed on a line before wrapping
   $input: 
   $space_conv: 

API Tags:
Access:  public


[ Top ]
EncodeString  [line 1246]

  string EncodeString( $str, [ $encoding = 'base64']  )

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

Parameters:
   $str: 
   $encoding: 

API Tags:
Access:  public


[ Top ]
EndBoundary  [line 1073]

  void EndBoundary( $boundary  )

Returns the end of a message boundary.

Parameters:
   $boundary: 

API Tags:
Access:  public


[ Top ]
GetBoundary  [line 1049]

  void GetBoundary( $boundary, $charSet, $contentType, $encoding  )

Returns the start of a message boundary.

Parameters:
   $boundary: 
   $charSet: 
   $contentType: 
   $encoding: 

API Tags:
Access:  public


[ Top ]
getFile  [line 1861]

  void getFile( string $filename  )

Read a file from a supplied filename and return it.

Parameters:
string   $filename:  Parameter File Name

API Tags:
Access:  public


[ Top ]
GetMailMIME  [line 940]

  string GetMailMIME( )

Returns the message MIME.


API Tags:
Access:  public


[ Top ]
HasMultiBytes  [line 1337]

  bool HasMultiBytes( string $str  )

Checks if a string contains multibyte characters.

Parameters:
string   $str:  multi-byte text to wrap encode

API Tags:
Access:  public


[ Top ]
HeaderLine  [line 1102]

  void HeaderLine( $name, $value  )

Parameters:
   $name: 
   $value: 

API Tags:
Access:  public


[ Top ]
InlineImageExists  [line 1529]

  bool InlineImageExists( )

Returns true if an inline attachment is present.


API Tags:
Access:  public


[ Top ]
IsError  [line 1674]

  bool IsError( )

Returns true if an error occurred.


API Tags:
Access:  public


[ Top ]
IsHTML  [line 278]

  void IsHTML( bool $bool  )

Sets message type to HTML.

Parameters:
bool   $bool: 

API Tags:
Access:  public


[ Top ]
IsMail  [line 298]

  void IsMail( )

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


API Tags:
Access:  public


[ Top ]
IsQmail  [line 314]

  void IsQmail( )

Sets Mailer to send message using the qmail MTA.


API Tags:
Access:  public


[ Top ]
IsSendmail  [line 306]

  void IsSendmail( )

Sets Mailer to send message using the $Sendmail program.


API Tags:
Access:  public


[ Top ]
IsSMTP  [line 290]

  void IsSMTP( )

Sets Mailer to send message using SMTP.


API Tags:
Access:  public


[ Top ]
MailSend  [line 468]

  bool MailSend( $header, $body  )

Sends mail using the PHP mail() function.

Parameters:
   $header: 
   $body: 

API Tags:
Access:  public


[ Top ]
MsgHTML  [line 1704]

  $message MsgHTML( $message, [ $basedir = '']  )

Evaluates the message and returns modifications for inline images and backgrounds

Parameters:
   $message: 
   $basedir: 

API Tags:
Access:  public


[ Top ]
SecureHeader  [line 1880]

  string SecureHeader( string $str  )

Strips newlines to prevent header injection.

Parameters:
string   $str:  String

API Tags:
Access:  public


[ Top ]
Send  [line 385]

  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.


API Tags:
Access:  public


[ Top ]
SendmailSend  [line 436]

  bool SendmailSend( $header, $body  )

Sends mail using the $Sendmail program.

Parameters:
   $header: 
   $body: 

API Tags:
Access:  public


[ Top ]
set  [line 1846]

  void set( string $name, [mixed $value = '']  )

Set (or reset) Class Objects (variables)

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

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

API Tags:
Access:  public


[ Top ]
SetLanguage  [line 665]

  bool SetLanguage( [string $lang_type = 'en'], [string $lang_path = 'language/']  )

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

Parameters:
string   $lang_type:  Type of language (e.g. Portuguese: "br")
string   $lang_path:  Path to the language file directory

API Tags:
Access:  public


[ Top ]
SetMessageType  [line 1082]

  void SetMessageType( )

Sets the message type.


API Tags:
Access:  public


[ Top ]
SetWordWrap  [line 838]

  void SetWordWrap( )

Set the body wrapping.


API Tags:
Access:  public


[ Top ]
Sign  [line 1894]

  void Sign( $cert_filename, string $key_filename, string $key_pass  )

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

Parameters:
string   $key_filename:  Parameter File Name
string   $key_pass:  Password for private key
   $cert_filename: 

API Tags:
Access:  public


[ Top ]
SmtpClose  [line 647]

  void SmtpClose( )

Closes the active SMTP session if one exists.


API Tags:
Access:  public


[ Top ]
SmtpConnect  [line 585]

  bool SmtpConnect( )

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


API Tags:
Access:  public


[ Top ]
SmtpSend  [line 518]

  bool SmtpSend( $header, $body  )

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:
   $header: 
   $body: 

API Tags:
Access:  public


[ Top ]
TextLine  [line 1111]

  string TextLine( $value  )

Returns a formatted mail line.

Parameters:
   $value: 

API Tags:
Access:  public


[ Top ]
UTF8CharBoundary  [line 800]

  int UTF8CharBoundary( string $encodedText, int $maxLength  )

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

Original written by Colin Brown.

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

API Tags:
Access:  public


[ Top ]
WrapText  [line 718]

  string 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:
   $message: 
   $length: 
   $qp_mode: 

API Tags:
Access:  public


[ Top ]
_mime_types  [line 1742]

  mime _mime_types( [ $ext = '']  )

Gets the mime type of the embedded or inline image

Parameters:
   $ext: 

API Tags:
Return:  type of ext
Access:  public


[ Top ]

Documentation generated on Mon, 09 Aug 2010 17:23:52 +0200 by phpDocumentor 1.4.1