Back to index

awl  0.53
Public Member Functions | Private Member Functions | Private Attributes
EMail Class Reference

List of all members.

Public Member Functions

 __construct ($subject="", $to="")
 

@-


 AddTo ($recipient)
 Add another recipient to the email.
 AddCc ($recipient)
 Add another Cc recipient to the email.
 AddBcc ($recipient)
 Add another Bcc recipient to the email.
 AddReplyTo ($recipient)
 Add another Reply-to address to the email.
 AddErrorsTo ($recipient)
 Add another Error recipient to the email.
 SetFrom ($sender)
 Set the visible From address for the e-mail.
 SetSender ($sender)
 Set the envelope sender address for the e-mail.
 SetSubject ($subject)
 Set the subject line for the email.
 SetBody ($body)
 Set the body of the e-mail.
 Send ($additional_headers="")
 Actually send the email.
 PretendLog ($additional_headers="")
 Don't actually send the email, just log it.
 Pretend ($additional_headers="")
 Don't actually send the email, just output it directly in the stream(!).

Private Member Functions

 _AppendDelimited (&$onto, $extra)
 Append something with a comma delimter onto the existing referenced string.

Private Attributes

 $To
 $From
 $Cc
 $Bcc
 $ErrorsTo
 $ReplyTo
 $Sender
 $Subject
 $Body

Detailed Description

Definition at line 16 of file EMail.php.


Constructor & Destructor Documentation

EMail::__construct ( subject = "",
to = "" 
)

@-

Create the e-mail, optionally assigning the subject and primary recipient.

Parameters:
string$subjectThe subject line of the email.
string$toA comma-separated list of addresses for the primary recipient(s).

Definition at line 82 of file EMail.php.

                                                  {
    // Initialise with some defaults
    $this->From    = "";
    $this->Subject = $subject;
    $this->To      = $to;
    $this->Cc      = "";
    $this->Bcc     = "";
    $this->ErrorsTo = "";
    $this->ReplyTo = "";
    $this->Sender  = "";
    $this->Body    = "";
  }

Member Function Documentation

EMail::_AppendDelimited ( &$  onto,
extra 
) [private]

Append something with a comma delimter onto the existing referenced string.

Parameters:
stringref&$ontoThe string we will be appending to.
string$extraWhat we will be appending
Returns:
string The new string.

Definition at line 101 of file EMail.php.

                                                      {
    if ( !isset($extra) || $extra == "" ) return false;
    if ( $onto != "" ) $onto .= ", ";
    $onto .= $extra;
    return $onto;
  }

Here is the caller graph for this function:

EMail::AddBcc ( recipient)

Add another Bcc recipient to the email.

Parameters:
string$recipientThe email address to append.
Returns:
string The new Bcc recipient list.

Definition at line 131 of file EMail.php.

                                {
    return $this->_AppendDelimited($this->Bcc, $recipient);
  }

Here is the call graph for this function:

EMail::AddCc ( recipient)

Add another Cc recipient to the email.

Parameters:
string$recipientThe email address to append.
Returns:
string The new Cc recipient list.

Definition at line 122 of file EMail.php.

                               {
    return $this->_AppendDelimited($this->Cc, $recipient);
  }

Here is the call graph for this function:

EMail::AddErrorsTo ( recipient)

Add another Error recipient to the email.

Parameters:
string$recipientThe email address to append.
Returns:
string The new Error recipient list.

Definition at line 149 of file EMail.php.

                                     {
    return $this->_AppendDelimited($this->ErrorsTo, $recipient);
  }

Here is the call graph for this function:

EMail::AddReplyTo ( recipient)

Add another Reply-to address to the email.

Parameters:
string$recipientThe email address to append.
Returns:
string The new Reply-to list.

Definition at line 140 of file EMail.php.

                                    {
    return $this->_AppendDelimited($this->ReplyTo, $recipient);
  }

Here is the call graph for this function:

EMail::AddTo ( recipient)

Add another recipient to the email.

Parameters:
string$recipientThe email address to append.
Returns:
string The new recipient list.

Definition at line 113 of file EMail.php.

                               {
    return $this->_AppendDelimited($this->To, $recipient);
  }

Here is the call graph for this function:

EMail::Pretend ( additional_headers = "")

Don't actually send the email, just output it directly in the stream(!).

We use this method when we're doing regression testing.

Parameters:
string$additional_headersAny additional headers that are needed.

Definition at line 238 of file EMail.php.

                                               {
    if ( !empty($this->From) )     print("From: $this->From\r\n");
    if ( !empty($this->Cc) )       print("Cc: $this->Cc\r\n");
    if ( !empty($this->Bcc) )      print("Bcc: $this->Bcc\r\n");
    if ( !empty($this->ReplyTo) )  print("Reply-To: $this->ReplyTo\r\n");
    if ( !empty($this->ErrorsTo) ) print("Errors-To: $this->ErrorsTo\r\n");

    $additional_parameters = "";
    if ( !empty($this->Sender) ) print("Envelope Sender set to: $this->Sender\r\n");
    print("To: $this->To\r\n");
    print("Subject: $this->Subject\r\n");
    print("Body: $this->Body\r\n");
  }
EMail::PretendLog ( additional_headers = "")

Don't actually send the email, just log it.

Parameters:
string$additional_headersAny additional headers that are needed.

Definition at line 219 of file EMail.php.

                                                  {
    if ( !empty($this->From) )     dbg_error_log('LOG', "From: $this->From");
    if ( !empty($this->Cc) )       dbg_error_log('LOG', "Cc: $this->Cc");
    if ( !empty($this->Bcc) )      dbg_error_log('LOG', "Bcc: $this->Bcc");
    if ( !empty($this->ReplyTo) )  dbg_error_log('LOG', "Reply-To: $this->ReplyTo");
    if ( !empty($this->ErrorsTo) ) dbg_error_log('LOG', "Errors-To: $this->ErrorsTo");

    $additional_parameters = "";
    if ( !empty($this->Sender) ) dbg_error_log('LOG', "Envelope Sender set to: $this->Sender");
    dbg_error_log('LOG', "To: $this->To");
    dbg_error_log('LOG', "Subject: $this->Subject");
    dbg_error_log('LOG', "Body: $this->Body");
  }
EMail::Send ( additional_headers = "")

Actually send the email.

Parameters:
string$additional_headersAny additional headers that are needed.

Definition at line 202 of file EMail.php.

                                            {
    if ( !empty($this->From) )     $additional_headers .= "From: $this->From\r\n";
    if ( !empty($this->Cc) )       $additional_headers .= "Cc: $this->Cc\r\n";
    if ( !empty($this->Bcc) )      $additional_headers .= "Bcc: $this->Bcc\r\n";
    if ( !empty($this->ReplyTo) )  $additional_headers .= "Reply-To: $this->ReplyTo\r\n";
    if ( !empty($this->ErrorsTo) ) $additional_headers .= "Errors-To: $this->ErrorsTo\r\n";

    $additional_parameters = "";
    if ( !empty($this->Sender) ) $additional_parameters = "-f$this->Sender";
    mail( $this->To, $this->Subject, $this->Body, $additional_headers, $additional_parameters );
  }
EMail::SetBody ( body)

Set the body of the e-mail.

Parameters:
string$recipientThe email address to append.
Returns:
string The new body of the e-mail.

Definition at line 192 of file EMail.php.

                            {
    $this->Body = $body;
    return $body;
  }
EMail::SetFrom ( sender)

Set the visible From address for the e-mail.

Parameters:
string$recipientThe visible From address
Returns:
string The new From address

Definition at line 159 of file EMail.php.

                              {
    $this->From = $sender;
    return $sender;
  }
EMail::SetSender ( sender)

Set the envelope sender address for the e-mail.

Parameters:
string$recipientThe e-mail address for the sender
Returns:
string The new envelope sender address.

Definition at line 170 of file EMail.php.

                                {
    $this->Sender = $sender;
    return $sender;
  }
EMail::SetSubject ( subject)

Set the subject line for the email.

Parameters:
string$recipientThe new subject line.
Returns:
string The new subject line.

Definition at line 181 of file EMail.php.

                                  {
    $this->Subject = $subject;
    return $subject;
  }

Member Data Documentation

EMail::$Bcc [private]

Definition at line 44 of file EMail.php.

EMail::$Body [private]

Definition at line 74 of file EMail.php.

EMail::$Cc [private]

Definition at line 38 of file EMail.php.

EMail::$ErrorsTo [private]

Definition at line 50 of file EMail.php.

EMail::$From [private]

Definition at line 32 of file EMail.php.

EMail::$ReplyTo [private]

Definition at line 56 of file EMail.php.

EMail::$Sender [private]

Definition at line 62 of file EMail.php.

EMail::$Subject [private]

Definition at line 68 of file EMail.php.

EMail::$To [private]

Definition at line 26 of file EMail.php.


The documentation for this class was generated from the following file: