Logo Search packages:      
Sourcecode: d-push version File versions  Download package

Mail_mimeDecode::getSendArray (  )

getSendArray() returns the arguments required for Mail::send() used to build the arguments for a mail::send() call

Usage: $mailtext = Full email (for example generated by a template) $decoder = new Mail_mimeDecode($mailtext); $parts = $decoder->getSendArray(); if (!PEARisError($parts) { list($recipents,$headers,$body) = $parts; $mail = Mail::factory('smtp'); $mail->send($recipents,$headers,$body); } else { echo $parts->message; }

Returns:
mixed array of recipeint, headers,body or Pear_Error public
Author:
Alan Knowles <alan@akbkhome.com>

Definition at line 750 of file mimeDecode.php.

References _parseHeaders(), and raiseError().

    {
        // prevent warning if this is not set
        $this->_decode_headers = FALSE;
        $headerlist =$this->_parseHeaders($this->_header);
        $to = "";
        if (!$headerlist) {
            return $this->raiseError("Message did not contain headers");
        }
        foreach($headerlist as $item) {
            $header[$item['name']] = $item['value'];
            switch (strtolower($item['name'])) {
                case "to":
                case "cc":
                case "bcc":
                    $to .= ",".$item['value'];
                default:
                   break;
            }
        }
        if ($to == "") {
            return $this->raiseError("Message did not contain any recipents");
        }
        $to = substr($to,1);
        return array($to,$header,$this->_body);
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index