linea21-externals
[ class tree: linea21-externals ] [ index: linea21-externals ] [ all elements ]

Class: PHPMailer

Source Location: /class/system/class.phpmailer.php

Class Overview


PHPMailer - PHP email transport class


Author(s):

  • Marcus Bointon
  • Andy Prevost

Version:

  • $Id: class.phpmailer.php 447 2009-05-25 01:36:38Z codeworxtech $

Copyright:

  • 2004 - 2009 Andy Prevost

Variables

Constants

Methods



Class Details

[line 44]
PHPMailer - PHP email transport class

NOTE: Requires PHP version 5 or later




Tags:

author:  Marcus Bointon
author:  Andy Prevost
version:  $Id: class.phpmailer.php 447 2009-05-25 01:36:38Z codeworxtech $
copyright:  2004 - 2009 Andy Prevost
filesource:  Source Code for this file
license:  GNU Lesser General Public License


[ Top ]


Class Variables

$action_function =  ''

[line 298]

Callback Action function name

the function that handles the result of the send email action. Parameters: bool $result result of the send action string $to email address of the recipient string $cc cc email addresses string $bcc bcc email addresses string $subject the subject string $body the email body




Tags:

access:  public

Type:   string


[ Top ]

$AltBody =  ''

[line 120]

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.



Tags:

access:  public

Type:   string


[ Top ]

$Body =  ''

[line 111]

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

If HTML then run IsHTML(true).




Tags:

access:  public

Type:   string


[ Top ]

$CharSet =  'iso-8859-1'

[line 60]

Sets the CharSet of the message.



Tags:

access:  public

Type:   string


[ Top ]

$ConfirmReadingTo =  ''

[line 152]

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



Tags:

access:  public

Type:   string


[ Top ]

$ContentType =  'text/plain'

[line 66]

Sets the Content-type of the message.



Tags:

access:  public

Type:   string


[ Top ]

$DKIM_domain =  ''

[line 278]

Used with DKIM DNS Resource Record

optional, in format of email address 'you@yourdomain.com'




Tags:

access:  public

Type:   string


[ Top ]

$DKIM_identity =  ''

[line 271]

Used with DKIM DNS Resource Record

optional, in format of email address 'you@yourdomain.com'




Tags:

access:  public

Type:   string


[ Top ]

$DKIM_private =  ''

[line 285]

Used with DKIM DNS Resource Record

optional, in format of email address 'you@yourdomain.com'




Tags:

access:  public

Type:   string


[ Top ]

$DKIM_selector =  'phpmailer'

[line 264]

Used with DKIM DNS Resource Record



Tags:

access:  public

Type:   string


[ Top ]

$Encoding =  '8bit'

[line 73]

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



Tags:

access:  public

Type:   string


[ Top ]

$ErrorInfo =  ''

[line 79]

Holds the most recent mailer error message.



Tags:

access:  public

Type:   string


[ Top ]

$From =  'root@localhost'

[line 85]

Sets the From email address for the message.



Tags:

access:  public

Type:   string


[ Top ]

$FromName =  'Root User'

[line 91]

Sets the From name of the message.



Tags:

access:  public

Type:   string


[ Top ]

$Helo =  ''

[line 193]

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



Tags:

access:  public

Type:   string


[ Top ]

$Host =  'localhost'

[line 181]

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.




Tags:

access:  public

Type:   string


[ Top ]

$Hostname =  ''

[line 160]

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



Tags:

access:  public

Type:   string


[ Top ]

$language = array()

[line 320]



Tags:

access:  protected

Type:   mixed


[ Top ]

$LE =  "\n"

[line 258]

Provides the ability to change the line ending



Tags:

access:  public

Type:   string


[ Top ]

$Mailer =  'mail'

[line 133]

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



Tags:

access:  public

Type:   string


[ Top ]

$MessageID =  ''

[line 167]

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

If empty, a unique id will be generated.




Tags:

access:  public

Type:   string


[ Top ]

$Password =  ''

[line 218]

Sets SMTP password.



Tags:

access:  public

Type:   string


[ Top ]

$PluginDir =  ''

[line 146]

Path to PHPMailer plugins. Useful if the SMTP class is in a different directory than the PHP include path.



Tags:

access:  public

Type:   string


[ Top ]

$Port =  25

[line 187]

Sets the default SMTP server port.



Tags:

access:  public

Type:   int


[ Top ]

$Priority =  3

[line 54]

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



Tags:

access:  public

Type:   int


[ Top ]

$Sender =  ''

[line 98]

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.



Tags:

access:  public

Type:   string


[ Top ]

$Sendmail =  '/usr/sbin/sendmail'

[line 139]

Sets the path of the sendmail program.



Tags:

access:  public

Type:   string


[ Top ]

$SingleTo =  false

[line 246]

Provides the ability to have the TO field process individual

emails, instead of sending to entire TO addresses




Tags:

access:  public

Type:   bool


[ Top ]

$SingleToArray = array()

[line 252]

If SingleTo is true, this provides the array to hold the email addresses



Tags:

access:  public

Type:   bool


[ Top ]

$SMTPAuth =  false

[line 206]

Sets SMTP authentication. Utilizes the Username and Password variables.



Tags:

access:  public

Type:   bool


[ Top ]

$SMTPDebug =  false

[line 231]

Sets SMTP class debugging on or off.



Tags:

access:  public

Type:   bool


[ Top ]

$SMTPKeepAlive =  false

[line 239]

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



Tags:

access:  public

Type:   bool


[ Top ]

$SMTPSecure =  ''

[line 200]

Sets connection prefix.

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




Tags:

access:  public

Type:   string


[ Top ]

$Subject =  ''

[line 104]

Sets the Subject of the message.



Tags:

access:  public

Type:   string


[ Top ]

$Timeout =  10

[line 225]

Sets the SMTP server timeout in seconds.

This function will not work with the win32 version.




Tags:

access:  public

Type:   int


[ Top ]

$Username =  ''

[line 212]

Sets SMTP username.



Tags:

access:  public

Type:   string


[ Top ]

$Version =  '5.1'

[line 304]

Sets the PHPMailer Version number



Tags:

access:  public

Type:   string


[ Top ]

$WordWrap =  0

[line 127]

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



Tags:

access:  public

Type:   int


[ Top ]



Class Methods


static method RFCDate [line 1925]

static string RFCDate( )

Returns the proper RFC 822 formatted date.



Tags:

access:  public


[ Top ]

static method ValidateAddress [line 524]

static boolean ValidateAddress( string $address)

Check that a string looks roughly like an email address should

Static so it can be used without instantiation Tries to use PHP built-in validator in the filter extension (from PHP 5.2), falls back to a reasonably competent regex validator Conforms approximately to RFC2822




Tags:



Parameters:

string   $address   The email address to check

[ Top ]

static method _mime_types [line 2042]

static string _mime_types( [string $ext = ''])

Gets the MIME type of the embedded or inline image



Tags:

return:  MIME type of ext
access:  public


Parameters:

string   $ext   File extension

[ Top ]

constructor __construct [line 343]

PHPMailer __construct( [boolean $exceptions = false])

Constructor



Tags:

access:  public


Parameters:

boolean   $exceptions   Should we throw external exceptions?

[ Top ]

method AddAddress [line 408]

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

Adds a "To" address.



Tags:

return:  true on success, false if address already used
access:  public


Parameters:

string   $address  
string   $name  

[ Top ]

method AddAttachment [line 1345]

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.




Tags:

access:  public


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.

[ Top ]

method AddBCC [line 430]

boolean AddBCC( string $address, [string $name = ''])

Adds a "Bcc" address.

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




Tags:

return:  true on success, false if address already used
access:  public


Parameters:

string   $address  
string   $name  

[ Top ]

method AddCC [line 419]

boolean AddCC( string $address, [string $name = ''])

Adds a "Cc" address.

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




Tags:

return:  true on success, false if address already used
access:  public


Parameters:

string   $address  
string   $name  

[ Top ]

method AddCustomHeader [line 1995]

void AddCustomHeader( $custom_header)

Adds a custom header.



Tags:

access:  public


Parameters:

   $custom_header  

[ Top ]

method AddEmbeddedImage [line 1784]

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



Tags:

access:  public


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.

[ Top ]

method AddrAppend [line 898]

string AddrAppend( $type, $addr)

Creates recipient headers.



Tags:

access:  public


Parameters:

   $type  
   $addr  

[ Top ]

method AddReplyTo [line 440]

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

Adds a "Reply-to" address.



Tags:

access:  public


Parameters:

string   $address  
string   $name  

[ Top ]

method AddrFormat [line 915]

string AddrFormat( $addr)

Formats an address correctly.



Tags:

access:  public


Parameters:

   $addr  

[ Top ]

method AddStringAttachment [line 1757]

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.




Tags:

access:  public


Parameters:

string   $string   String attachment data.
string   $filename   Name of the attachment.
string   $encoding   File encoding (see $Encoding).
string   $type   File extension (MIME) type.

[ Top ]

method Base64EncodeWrapMB [line 1600]

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




Tags:

access:  public


Parameters:

string   $str   multi-byte text to wrap encode

[ Top ]

method ClearAddresses [line 1833]

void ClearAddresses( )

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



Tags:

access:  public


[ Top ]

method ClearAllRecipients [line 1875]

void ClearAllRecipients( )

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



Tags:

access:  public


[ Top ]

method ClearAttachments [line 1887]

void ClearAttachments( )

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



Tags:

access:  public


[ Top ]

method ClearBCCs [line 1855]

void ClearBCCs( )

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



Tags:

access:  public


[ Top ]

method ClearCCs [line 1844]

void ClearCCs( )

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



Tags:

access:  public


[ Top ]

method ClearCustomHeaders [line 1895]

void ClearCustomHeaders( )

Clears all custom headers. Returns void.



Tags:

access:  public


[ Top ]

method ClearReplyTos [line 1866]

void ClearReplyTos( )

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



Tags:

access:  public


[ Top ]

method CreateBody [line 1191]

string CreateBody( )

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



Tags:

return:  The assembled message body
access:  public


[ Top ]

method CreateHeader [line 1074]

string CreateHeader( )

Assembles message header.



Tags:

return:  The assembled header
access:  public


[ Top ]

method DKIM_Add [line 2272]

void DKIM_Add( string $headers_line, string $subject, string $body)

Create the DKIM header, body, as new header



Tags:

access:  public


Parameters:

string   $headers_line   Header lines
string   $subject   Subject
string   $body   Body

[ Top ]

method DKIM_BodyC [line 2252]

void DKIM_BodyC( string $body)

Generate DKIM Canonicalization Body



Tags:

access:  public


Parameters:

string   $body   Message Body

[ Top ]

method DKIM_HeaderC [line 2233]

void DKIM_HeaderC( string $s)

Generate DKIM Canonicalization Header



Tags:

access:  public


Parameters:

string   $s   Header

[ Top ]

method DKIM_QP [line 2195]

void DKIM_QP( $txt, string $key_filename, string $key_pass)

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



Tags:

access:  public


Parameters:

string   $key_filename   Parameter File Name
string   $key_pass   Password for private key
   $txt  

[ Top ]

method DKIM_Sign [line 2215]

void DKIM_Sign( string $s)

Generate DKIM signature



Tags:

access:  public


Parameters:

string   $s   Header

[ Top ]

method doCallback [line 2307]

void doCallback( $isSent, $to, $cc, $bcc, $subject, $body)



Tags:

access:  protected


Parameters:

   $isSent  
   $to  
   $cc  
   $bcc  
   $subject  
   $body  

[ Top ]

method EncodeHeader [line 1523]

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

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



Tags:

access:  public


Parameters:

   $str  
   $position  

[ Top ]

method EncodeQ [line 1722]

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

Encode string to q encoding.



Tags:

link:  http://tools.ietf.org/html/rfc2047
access:  public


Parameters:

string   $str   the text to encode
string   $position   Where the text is going to be used, see the RFC for what that means

[ Top ]

method EncodeQP [line 1693]

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

Encode string to RFC2045 (6.7) quoted-printable format

Uses a PHP5 stream filter to do the encoding about 64x faster than the old version Also results in same content as you started with after decoding




Tags:

author:  Marcus Bointon
see:  PHPMailer::EncodeQPphp()
access:  public


Parameters:

string   $string   the text to encode
integer   $line_max   Number of chars allowed on a line before wrapping
boolean   $space_conv   Dummy param for compatibility with existing EncodeQP function

[ Top ]

method EncodeQPphp [line 1640]

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

Encode string to quoted-printable.

Only uses standard PHP, slow, but will always work




Tags:

access:  public


Parameters:

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

[ Top ]

method EncodeString [line 1492]

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

Encodes string to requested format.

Returns an empty string on failure.




Tags:

access:  public


Parameters:

string   $str   The text to encode
string   $encoding   The encoding to use; one of 'base64', '7bit', '8bit', 'binary', 'quoted-printable'

[ Top ]

method GetAttachments [line 1383]

array GetAttachments( )

Return the current array of attachments



Tags:

access:  public


[ Top ]

method GetMailMIME [line 1157]

string GetMailMIME( )

Returns the message MIME.



Tags:

access:  public


[ Top ]

method GetTranslations [line 885]

array GetTranslations( )

Return the current array of language strings



Tags:

access:  public


[ Top ]

method HasMultiBytes [line 1584]

bool HasMultiBytes( string $str)

Checks if a string contains multibyte characters.



Tags:

access:  public


Parameters:

string   $str   multi-byte text to wrap encode

[ Top ]

method HeaderLine [line 1318]

string HeaderLine( $name, $value)

Returns a formatted header line.



Tags:

access:  public


Parameters:

   $name  
   $value  

[ Top ]

method InlineImageExists [line 1816]

bool InlineImageExists( )

Returns true if an inline attachment is present.



Tags:

access:  public


[ Top ]

method IsError [line 1974]

bool IsError( )

Returns true if an error occurred.



Tags:

access:  public


[ Top ]

method IsHTML [line 352]

void IsHTML( [bool $ishtml = true])

Sets message type to HTML.



Tags:

access:  public


Parameters:

bool   $ishtml  

[ Top ]

method IsMail [line 372]

void IsMail( )

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



Tags:

access:  public


[ Top ]

method IsQmail [line 391]

void IsQmail( )

Sets Mailer to send message using the qmail MTA.



Tags:

access:  public


[ Top ]

method IsSendmail [line 380]

void IsSendmail( )

Sets Mailer to send message using the $Sendmail program.



Tags:

access:  public


[ Top ]

method IsSMTP [line 364]

void IsSMTP( )

Sets Mailer to send message using SMTP.



Tags:

access:  public


[ Top ]

method MailSend [line 645]

bool MailSend( string $header, string $body)

Sends mail using the PHP mail() function.



Tags:

access:  protected


Parameters:

string   $header   The message headers
string   $body   The message body

[ Top ]

method MsgHTML [line 2004]

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

Evaluates the message and returns modifications for inline images and backgrounds



Tags:

access:  public


Parameters:

   $message  
   $basedir  

[ Top ]

method SecureHeader [line 2169]

string SecureHeader( string $str)

Strips newlines to prevent header injection.



Tags:

access:  public


Parameters:

string   $str   String

[ Top ]

method Send [line 546]

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.



Tags:

access:  public


[ Top ]

method SendmailSend [line 599]

bool SendmailSend( string $header, string $body)

Sends mail using the $Sendmail program.



Tags:

access:  protected


Parameters:

string   $header   The message headers
string   $body   The message body

[ Top ]

method set [line 2147]

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

Set (or reset) Class Objects (variables)

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




Tags:

todo:  Should this not be using __set() magic function?
access:  public


Parameters:

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

[ Top ]

method SetError [line 1908]

void SetError( $msg)

Adds the error message to the error container.



Tags:

access:  protected


Parameters:

   $msg  

[ Top ]

method SetFrom [line 489]

boolean SetFrom( string $address, [string $name = ''], [ $auto = 1])

Set the From and FromName properties



Tags:

access:  public


Parameters:

string   $address  
string   $name  
   $auto  

[ Top ]

method SetLanguage [line 851]

void SetLanguage( [string $langcode = '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 is English.




Tags:

access:  public


Parameters:

string   $langcode   ISO 639-1 2-character language code (e.g. Portuguese: "br")
string   $lang_path   Path to the language file directory

[ Top ]

method SetWordWrap [line 1053]

void SetWordWrap( )

Set the body wrapping.



Tags:

access:  public


[ Top ]

method Sign [line 2182]

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

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



Tags:

access:  public


Parameters:

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

[ Top ]

method SmtpClose [line 835]

void SmtpClose( )

Closes the active SMTP session if one exists.



Tags:

access:  public


[ Top ]

method SmtpConnect [line 773]

bool SmtpConnect( )

Initiates a connection to an SMTP server.

Returns false if the operation failed.




Tags:

access:  public
uses:  SMTP


[ Top ]

method SmtpSend [line 702]

bool SmtpSend( string $header, string $body)

Sends mail via SMTP using PhpSMTP Returns false if there is a bad MAIL FROM, RCPT, or DATA input.



Tags:

access:  protected
uses:  SMTP


Parameters:

string   $header   The message headers
string   $body   The message body

[ Top ]

method TextLine [line 1327]

string TextLine( $value)

Returns a formatted mail line.



Tags:

access:  public


Parameters:

   $value  

[ Top ]

method UTF8CharBoundary [line 1015]

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.




Tags:

access:  public


Parameters:

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

[ Top ]

method WrapText [line 933]

string WrapText( string $message, integer $length, [boolean $qp_mode = false])

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

Original written by philippe.




Tags:

access:  public


Parameters:

string   $message   The message to wrap
integer   $length   The line length to wrap to
boolean   $qp_mode   Whether to run in Quoted-Printable mode

[ Top ]


Class Constants

STOP_CONTINUE =  1

[line 332]


[ Top ]

STOP_CRITICAL =  2

[line 333]


[ Top ]

STOP_MESSAGE =  0

[line 331]


[ Top ]



Documentation generated on Thu, 03 May 2012 15:02:44 +0200 by phpDocumentor 1.4.1