Class Deliver

Description

Deliver Class - called to actually deliver the message

This class is called by compose.php and other code that needs to send messages. All delivery functionality should be centralized in this class.

Do not place UI code in this class, as UI code should be placed in templates going forward.

  • author: Marc Groot Koerkamp

Located in /class/deliver/Deliver.class.php (line 29)


	
			
Direct descendents
Class Description
Deliver_IMAP This class is incomplete and entirely undocumented.
Deliver_SMTP Deliver messages using SMTP
Deliver_SendMail Delivers messages using the sendmail binary
Method Summary
void clean_crlf (string &$s)
string foldLine (string $line, integer $length, [string $pre = ''])
void getBCC ()
handle initStream (Message $message, [ $length = 0], [string $host = ''], [ $port = ''], [string $user = ''], [string $pass = ''], integer $length )
string ip2hex (string $string)
integer mail (Message $message, [resource $stream = false])
string mimeBoundary ()
string prepareMIME_Header (Message $message, string $boundary)
string prepareRFC822_Header (Rfc822Header $rfc822_header, Rfc822Header $reply_rfc822_header, integer &$raw_length)
void preWriteToStream (string &$s)
void strip_crlf (string &$s)
string timezone ()
void writeBody (Message $message, resource $stream, integer &$length_raw, [string $boundary = ''])
void writeBodyPart (Message $message, resource $stream, integer &$length)
void writeToStream (resource $stream, string $data)
Methods
calculate_references (line 732)

function calculate_references - calculate correct References string Adds the current message ID, and makes sure it doesn't grow forever, to that extent it drops message-ID's in a smart way until the string length is under the recommended value of 1000 ("References: <986>\r\n").

It always keeps the first and the last three ID's.

  • return: concatenated and trimmed References string
string calculate_references (Rfc822Header $hdr)
clean_crlf (line 220)

function clean_crlf - change linefeeds and newlines to legal characters

The SMTP format only allows CRLF as line terminators. This function replaces illegal teminators with the correct terminator.

void clean_crlf (string &$s)
  • string &$s: string to clean linefeeds on
foldLine (line 591)

function foldLine - for cleanly folding of headerlines

  • return: folded line with trailing CRLF
string foldLine (string $line, integer $length, [string $pre = ''])
  • string $line
  • integer $length: length to fold the line at
  • string $pre: prefix the line with...
getBCC (line 293)

function getBCC - reserved for extended functionality

This function is not yet implemented. Reserved for extended functionality.

void getBCC ()
initStream (line 282)

function initStream - reserved for extended functionality

This function is not yet implemented. Reserved for extended functionality.

  • return: file handle resource to SMTP stream
handle initStream (Message $message,  $length, [string $host = ''], [ $port = ''], [string $user = ''], [string $pass = ''], integer $length )
  • Message $message: Message object
  • string $host: host name or IP to connect to
  • string $user: username to log into the SMTP server with
  • string $pass: password to log into the SMTP server with
  • integer $length
  • $length
  • $port

Redefined in descendants as:
ip2hex (line 768)

Converts ip address to hexadecimal string

Function is used to convert ipv4 and ipv6 addresses to hex strings. It removes all delimiter symbols from ip addresses, converts decimal ipv4 numbers to hex and pads strings in order to present full length address. ipv4 addresses are represented as 8 byte strings, ipv6 addresses are represented as 32 byte string.

If function fails to detect address format, it returns unprocessed string.

  • return: processed ip address string
  • since: 1.5.1 and 1.4.5
string ip2hex (string $string)
  • string $string: ip address string
mail (line 39)

function mail - send the message parts to the SMTP stream

integer mail (Message $message, [resource $stream = false])
  • Message $message: Message class to send
  • resource $stream: file handle to the SMTP stream
mimeBoundary (line 684)

function mimeBoundary - calculates the mime boundary to use

This function will generate a random mime boundary base part for the message if the boundary has not already been set.

  • return: random mime boundary string
string mimeBoundary ()
prepareMIME_Header (line 305)

function prepareMIME_Header - creates the mime header

  • return: properly formatted mime header
string prepareMIME_Header (Message $message, string $boundary)
  • Message $message: Message object to act on
  • string $boundary: mime boundary from fn MimeBoundary
prepareRFC822_Header (line 380)

function prepareRFC822_Header - prepares the RFC822 header string from Rfc822Header object(s)

This function takes the Rfc822Header object(s) and formats them into the RFC822Header string to send to the SMTP server as part of the SMTP message.

string prepareRFC822_Header (Rfc822Header $rfc822_header, Rfc822Header $reply_rfc822_header, integer &$raw_length)
preWriteToStream (line 253)

function preWriteToStream - reserved for extended functionality

This function is not yet implemented. Reserved for extended functionality.

void preWriteToStream (string &$s)
  • string &$s: string to operate on

Redefined in descendants as:
strip_crlf (line 237)

function strip_crlf - strip linefeeds and newlines from a string

The SMTP format only allows CRLF as line terminators. This function strips all line terminators from the string.

void strip_crlf (string &$s)
  • string &$s: string to clean linefeeds on
timezone (line 700)

function timezone - Time offset for correct timezone

  • return: with timezone and offset
string timezone ()
writeBody (line 74)

function writeBody - generate and write the mime boundaries around each part to the stream

Recursively formats and writes the MIME boundaries of the $message to the output stream.

void writeBody (Message $message, resource $stream, integer &$length_raw, [string $boundary = ''])
  • Message $message: Message object to transform
  • resource $stream: SMTP output stream
  • integer &$length_raw: raw length of the message (part) as returned by mail fn
  • string $boundary: custom boundary to call, usually for subparts
writeBodyPart (line 131)

function writeBodyPart - write each individual mimepart

Recursively called by WriteBody to write each mime part to the SMTP stream

void writeBodyPart (Message $message, resource $stream, integer &$length)
  • Message $message: Message object to transform
  • resource $stream: SMTP output stream
  • integer &$length: length of the message part as returned by mail fn
writeToStream (line 264)

function writeToStream - write data to the SMTP stream

void writeToStream (resource $stream, string $data)
  • resource $stream: SMTP output stream
  • string $data: string with data to send to the SMTP stream

Documentation generated on Sat, 07 Oct 2006 16:10:36 +0300 by phpDocumentor 1.3.0RC6