cvs: php4 /pear Mail.php

From: Date: Thu, 09 Aug 2001 07:52:29 +0000
Subject: cvs: php4 /pear Mail.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-442@lists.php.net to get a copy of this message
cox Thu Aug 9 03:52:29 2001 EDT Modified files: /php4/pear Mail.php Log: spaces Index: php4/pear/Mail.php diff -u php4/pear/Mail.php:1.11 php4/pear/Mail.php:1.12 --- php4/pear/Mail.php:1.11 Wed Aug 8 21:11:56 2001 +++ php4/pear/Mail.php Thu Aug 9 03:52:29 2001 @@ -16,7 +16,7 @@ // | Authors: Chuck Hagenbuch <chuck@horde.org> | // +----------------------------------------------------------------------+ // -// $Id: Mail.php,v 1.11 2001/08/09 01:11:56 alexmerz Exp $ +// $Id: Mail.php,v 1.12 2001/08/09 07:52:29 cox Exp $ require_once 'PEAR.php'; @@ -24,25 +24,25 @@ * PEAR's Mail:: interface. Defines the interface for implementing * mailers under the PEAR hierarchy, and provides supporting functions * useful in multiple mailer backends. - * + * * @access public - * @version $Revision: 1.11 $ + * @version $Revision: 1.12 $ * @package Mail */ class Mail extends PEAR { - + /** * Provides an interface for generating Mail:: objects of various * types * * @param string $driver The kind of Mail:: object to instantiate. - * @param array $params The parameters to pass to the Mail:: object. + * @param array $params The parameters to pass to the Mail:: object. @ @return object Mail a instance of the driver class or if fails a PEAR Error * @access public */ function factory($driver, $params = array()) { - $driver = strtolower($driver); + $driver = strtolower($driver); if (@include_once 'Mail/' . $driver . '.php') { $class = 'Mail_' . $driver; return new $class($params); @@ -51,8 +51,8 @@ } } - - /** + + /** * Implements Mail::send() function using php's built-in mail() * command. * @@ -77,14 +77,14 @@ * failure. * @access public * @deprecated use Mail_mail::send instead - */ + */ function send($recipients, $headers, $body) { // if we're passed an array of recipients, implode it. if (is_array($recipients)) { $recipients = implode(', ', $recipients); } - + // get the Subject out of the headers array so that we can // pass it as a seperate argument to mail(). $subject = ''; @@ -92,14 +92,14 @@ $subject = $headers['Subject']; unset($headers['Subject']); } - + // flatten the headers out. list(,$text_headers) = Mail::prepareHeaders($headers); - + return mail($recipients, $subject, $body, $text_headers); } - + /** * Take an array of mail headers and return a string containing * text usable in sending a message. @@ -121,11 +121,11 @@ // Look out for the From: value to use along the way. $text_headers = ''; // text representation of headers $from = null; - + foreach ($headers as $key => $val) { if ($key == 'From') { include_once 'Mail/RFC822.php'; - + $from_arr = Mail_RFC822::parseAddressList($val, 'localhost', false); $from = $from_arr[0]->mailbox . '@' . $from_arr[0]->host; if (strstr($from, ' ')) { @@ -142,10 +142,10 @@ $text_headers .= $key . ': ' . $val . "\n"; } } - + return array($from, $text_headers); } - + /** * Take a set of recipients and parse them, returning an array of * bare addresses (forward paths) that can be passed to sendmail @@ -161,13 +161,13 @@ function parseRecipients($recipients) { include_once 'Mail/RFC822.php'; - + // if we're passed an array, assume addresses are valid and // implode them before parsing. if (is_array($recipients)) { $recipients = implode(', ', $recipients); } - + // Parse recipients, leaving out all personal info. This is // for smtp recipients, etc. All relevant personal information // should already be in the headers. @@ -178,9 +178,9 @@ $recipients[] = $ob->mailbox . '@' . $ob->host; } } - + return $recipients; } - + } -?> +?> \ No newline at end of file

« previous php.pear.cvs (#442) next »