Index: /branches/feature-module-update/html/mobile/require.php
===================================================================
--- /branches/feature-module-update/html/mobile/require.php	(revision 16393)
+++ /branches/feature-module-update/html/mobile/require.php	(revision 16503)
@@ -37,5 +37,5 @@
 require_once(CLASS_PATH . "SC_UploadFile.php");
 require_once(CLASS_PATH . "SC_SiteInfo.php");
-require_once(CLASS_PATH . "SC_SendMail.php");
+require_once(CLASS_EX_PATH . "SC_SendMail_Ex.php");
 require_once(CLASS_PATH . "SC_FormParam.php");
 require_once(CLASS_PATH . "SC_CartSession.php");
Index: /branches/feature-module-update/html/require.php
===================================================================
--- /branches/feature-module-update/html/require.php	(revision 16393)
+++ /branches/feature-module-update/html/require.php	(revision 16503)
@@ -35,5 +35,5 @@
 require_once(CLASS_PATH . "SC_UploadFile.php");
 require_once(CLASS_PATH . "SC_SiteInfo.php");
-require_once(CLASS_PATH . "SC_SendMail.php");
+require_once(CLASS_EX_PATH . "SC_SendMail_Ex.php");
 require_once(CLASS_PATH . "SC_FormParam.php");
 require_once(CLASS_PATH . "SC_CartSession.php");
Index: /branches/feature-module-update/data/class/SC_SendMail.php
===================================================================
--- /branches/feature-module-update/data/class/SC_SendMail.php	(revision 16330)
+++ /branches/feature-module-update/data/class/SC_SendMail.php	(revision 16503)
@@ -5,5 +5,5 @@
  * http://www.lockon.co.jp/
  */
- 
+
 require_once(dirname(__FILE__) . '/../module/Mail/Mail.php');
 require_once(dirname(__FILE__) . '/../module/Mail/mime.php');
@@ -12,32 +12,88 @@
 class SC_SendMail {
 
-	var $to;			//	送信先
-	var $subject;		//	題名
-	var $body;			//	本文
-	var $cc;			// CC
-	var $bcc;			// BCC
-	var $replay_to;		// replay_to
-	var $return_path;	// return_path
-	var $arrEncode;
-	var $objMailMime;
-	var $arrTEXTEncode;
-	var $arrHTMLEncode;
-	var $objMail;
-			
-	// コンストラクタ
-	function SC_SendMail() {
-		$this->to = "";
-		$this->subject = "";
-		$this->body = "";
-		$this->cc = "";
-		$this->bcc = "";
-		$this->replay_to = "";
-		$this->return_path = "";
-		$this->arrEncode = array();
-		$this->host = SMTP_HOST;
-		$this->port = SMTP_PORT;
-		$this->objMailMime = new Mail_mime();
-		mb_language( "Japanese" );
-        $arrHost = array(   
+    var $to;            //  送信先
+    var $subject;       //  題名
+    var $body;          //  本文
+    var $cc;            // CC
+    var $bcc;           // BCC
+    var $replay_to;     // replay_to
+    var $return_path;   // return_path
+    var $arrEncode;
+    var $objMailMime;
+    var $arrTEXTEncode;
+    var $arrHTMLEncode;
+    var $objMail;
+
+    // コンストラクタ
+    function SC_SendMail() {
+        $this->to = "";
+        $this->subject = "";
+        $this->body = "";
+        $this->cc = "";
+        $this->bcc = "";
+        $this->replay_to = "";
+        $this->return_path = "";
+        $this->arrEncode = array();
+        $this->backend = MAIL_BACKEND;
+        $this->host = SMTP_HOST;
+        $this->port = SMTP_PORT;
+        $this->objMailMime = new Mail_mime();
+        mb_language( "Japanese" );
+
+        //-- PEAR::Mailを使ってメール送信オブジェクト作成
+        $this->objMail =& Mail::factory($this->backend,
+                                        $this->getBackendParams($this->backend));
+    }
+
+    // 宛先の設定
+    function setTo($to, $to_name = "") {
+        $this->to = $this->getNameAddress($to_name, $to);
+    }
+
+    // 送信元の設定
+    function setFrom($from, $from_name = "") {
+        $this->from = $this->getNameAddress($from_name, $from);
+    }
+
+    // CCの設定
+    function setCc($cc, $cc_name = "") {
+        if($cc != "") {
+            $this->cc = $this->getNameAddress($cc_name, $cc);
+        }
+    }
+
+    // BCCの設定
+    function setBCc($bcc) {
+        if($bcc != "") {
+            $this->bcc = $bcc;
+        }
+    }
+
+    // Reply-Toの設定
+    function setReplyTo($reply_to) {
+        if($reply_to != "") {
+            $this->reply_to = $reply_to;
+        }
+    }
+
+    // Return-Pathの設定
+    function setReturnPath($return_path) {
+        $this->return_path = $return_path;
+    }
+
+    // 件名の設定
+    function setSubject($subject) {
+        $this->subject = mb_encode_mimeheader($subject);
+    }
+
+    // 本文の設定
+    function setBody($body) {
+        $this->body = mb_convert_encoding($body, "JIS", CHAR_CODE);
+    }
+
+    // SMTPサーバの設定
+    function setHost($host) {
+        $this->host = $host;
+        $arrHost = array(
                 'host' => $this->host,
                 'port' => $this->port
@@ -45,56 +101,11 @@
         //-- PEAR::Mailを使ってメール送信オブジェクト作成
         $this->objMail =& Mail::factory("smtp", $arrHost);
-	}
-	
-	// 宛先の設定
-	function setTo($to, $to_name = "") {
-		$this->to = $this->getNameAddress($to_name, $to);
-	}
-	
-	// 送信元の設定
-	function setFrom($from, $from_name = "") {
-		$this->from = $this->getNameAddress($from_name, $from);
-	}
-	
-	// CCの設定
-	function setCc($cc, $cc_name = "") {
-		if($cc != "") {
-			$this->cc = $this->getNameAddress($cc_name, $cc);
-		}
-	}
-	
-	// BCCの設定
-	function setBCc($bcc) {
-		if($bcc != "") {
-			$this->bcc = $bcc;
-		}
-	}
-	
-	// Reply-Toの設定
-	function setReplyTo($reply_to) {
-		if($reply_to != "") {
-			$this->reply_to = $reply_to;			
-		}		
-	}
-	
-	// Return-Pathの設定
-	function setReturnPath($return_path) {
-		$this->return_path = $return_path;
-	}	
-	
-	// 件名の設定
-	function setSubject($subject) {
-		$this->subject = mb_encode_mimeheader($subject);
-	}
-	
-	// 本文の設定
-	function setBody($body) {
-		$this->body = mb_convert_encoding($body, "JIS", CHAR_CODE);
-	}
-	
-	// SMTPサーバの設定
-	function setHost($host) {
-		$this->host = $host;
-		$arrHost = array(   
+
+    }
+
+    // SMTPポートの設定
+    function setPort($port) {
+        $this->port = $port;
+        $arrHost = array(
                 'host' => $this->host,
                 'port' => $this->port
@@ -102,147 +113,163 @@
         //-- PEAR::Mailを使ってメール送信オブジェクト作成
         $this->objMail =& Mail::factory("smtp", $arrHost);
-		
-	}
-	
-	// SMTPポートの設定
-	function setPort($port) {
-		$this->port = $port;
-		$arrHost = array(   
-                'host' => $this->host,
-                'port' => $this->port
-        );
-        //-- PEAR::Mailを使ってメール送信オブジェクト作成
-        $this->objMail =& Mail::factory("smtp", $arrHost);		
-	}
-	
-	// 名前<メールアドレス>の形式を生成
-	function getNameAddress($name, $mail_address) {
-			if($name != "") {
-				// 制御文字を変換する。				
-				$_name = $name;				
-				$_name = ereg_replace("<","＜", $_name);
-				$_name = ereg_replace(">","＞", $_name);
-				if(OS_TYPE != 'WIN') {
-					// windowsでは文字化けするので使用しない。
-					$_name = mb_convert_encoding($_name,"JIS",CHAR_CODE);	
-				}
-				$_name = mb_encode_mimeheader($_name);
-				$name_address = "\"". $_name . "\"<" . $mail_address . ">";
-			} else {
-				$name_address = $mail_address;
-			}
-			return $name_address;
-	}
-	
-	function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) {
-		$this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc);
-	}
-	
-	function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) {
-		$this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc);
-	}
-
-	/*	ヘッダ等を格納
-		 $to			-> 送信先メールアドレス
-		 $subject		-> メールのタイトル
-		 $body			-> メール本文
-		 $fromaddress	-> 送信元のメールアドレス
-		 $header		-> ヘッダー
-		 $from_name		-> 送信元の名前（全角OK）
-		 $reply_to		-> reply_to設定
-		 $return_path	-> return-pathアドレス設定（エラーメール返送用）
-		 $cc			-> カーボンコピー
-		 $bcc			-> ブラインドカーボンコピー
-	*/		
-	function setBase( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) {
-		// 宛先設定
-		$this->to = $to;	
-		// 件名設定
-		$this->setSubject($subject);
-		// 本文設定(iso-2022-jpだと特殊文字が？で送信されるのでJISを使用する)
-		$this->setBody($body);
-		// 送信元設定
-		$this->setFrom($fromaddress, $from_name);
-		// 返信先設定
-		$this->setReplyTo($reply_to);
-		// CC設定
-		$this->setCc($cc);
-		// BCC設定
-		$this->setBcc($bcc);
-		
-		// Errors-Toは、ほとんどのSMTPで無視され、Return-Pathが優先されるためReturn_Pathに設定する。
-		if($errors_to != "") {
-			$this->return_path = $errors_to;
-		} else if($return_path != "") {
-			$this->return_path = $return_path;
-		} else {
-			$this->return_path = $fromaddress;
-		}
-	}
-	
-	// ヘッダーを返す
-	function getBaseHeader() {
-		//-- 送信するメールの内容と送信先
-		$arrHeader['MIME-Version'] = '1.0';
-		$arrHeader['To'] = $this->to;
-		$arrHeader['Subject'] = $this->subject;
-		$arrHeader['From'] = $this->from;
-		$arrHeader['Return-Path'] = $this->return_path;
-		
-		if($this->reply_to != "") {
-			$arrHeader['Reply-To'] = $this->reply_to;
-		}
-		
-		if($this->cc != "") {
-			$arrHeader['Cc'] = $this->cc;
-		}
-		
-		if($this->bcc != "") {		
-			$arrHeader['Bcc'] = $this->bcc;
-		}
-		return $arrHeader;
-	}
-	
-	// ヘッダーを返す
-	function getTEXTHeader() {
-		$arrHeader = $this->getBaseHeader();
-		$arrHeader['Content-Type'] = "text/plain; charset=\"ISO-2022-JP\"";
-    	$arrHeader['Content-Transfer-Encoding'] = "7bit";	
-		return $arrHeader;
-	}
-	
-	// ヘッダーを返す
-	function getHTMLHeader() {
-		$arrHeader = $this->getBaseHeader();
-		$arrHeader['Content-Type'] = "text/html; charset=\"ISO-2022-JP\"";
-    	$arrHeader['Content-Transfer-Encoding'] = "ISO-2022-JP";	
-		return $arrHeader;
-	}
-	
-	//	TXTメール送信を実行する
-	function sendMail() {
-		$header = $this->getTEXTHeader();
+    }
+
+    // 名前<メールアドレス>の形式を生成
+    function getNameAddress($name, $mail_address) {
+            if($name != "") {
+                // 制御文字を変換する。
+                $_name = $name;
+                $_name = ereg_replace("<","＜", $_name);
+                $_name = ereg_replace(">","＞", $_name);
+                if(OS_TYPE != 'WIN') {
+                    // windowsでは文字化けするので使用しない。
+                    $_name = mb_convert_encoding($_name,"JIS",CHAR_CODE);
+                }
+                $_name = mb_encode_mimeheader($_name);
+                $name_address = "\"". $_name . "\"<" . $mail_address . ">";
+            } else {
+                $name_address = $mail_address;
+            }
+            return $name_address;
+    }
+
+    function setItem( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) {
+        $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc);
+    }
+
+    function setItemHtml( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) {
+        $this->setBase($to, $subject, $body, $fromaddress, $from_name, $reply_to, $return_path, $errors_to, $bcc, $cc);
+    }
+
+    /*  ヘッダ等を格納
+         $to            -> 送信先メールアドレス
+         $subject       -> メールのタイトル
+         $body          -> メール本文
+         $fromaddress   -> 送信元のメールアドレス
+         $header        -> ヘッダー
+         $from_name     -> 送信元の名前（全角OK）
+         $reply_to      -> reply_to設定
+         $return_path   -> return-pathアドレス設定（エラーメール返送用）
+         $cc            -> カーボンコピー
+         $bcc           -> ブラインドカーボンコピー
+    */
+    function setBase( $to, $subject, $body, $fromaddress, $from_name, $reply_to="", $return_path="", $errors_to="", $bcc="", $cc ="" ) {
+        // 宛先設定
+        $this->to = $to;
+        // 件名設定
+        $this->setSubject($subject);
+        // 本文設定(iso-2022-jpだと特殊文字が？で送信されるのでJISを使用する)
+        $this->setBody($body);
+        // 送信元設定
+        $this->setFrom($fromaddress, $from_name);
+        // 返信先設定
+        $this->setReplyTo($reply_to);
+        // CC設定
+        $this->setCc($cc);
+        // BCC設定
+        $this->setBcc($bcc);
+
+        // Errors-Toは、ほとんどのSMTPで無視され、Return-Pathが優先されるためReturn_Pathに設定する。
+        if($errors_to != "") {
+            $this->return_path = $errors_to;
+        } else if($return_path != "") {
+            $this->return_path = $return_path;
+        } else {
+            $this->return_path = $fromaddress;
+        }
+    }
+
+    // ヘッダーを返す
+    function getBaseHeader() {
+        //-- 送信するメールの内容と送信先
+        $arrHeader['MIME-Version'] = '1.0';
+        $arrHeader['To'] = $this->to;
+        $arrHeader['Subject'] = $this->subject;
+        $arrHeader['From'] = $this->from;
+        $arrHeader['Return-Path'] = $this->return_path;
+
+        if($this->reply_to != "") {
+            $arrHeader['Reply-To'] = $this->reply_to;
+        }
+
+        if($this->cc != "") {
+            $arrHeader['Cc'] = $this->cc;
+        }
+
+        if($this->bcc != "") {
+            $arrHeader['Bcc'] = $this->bcc;
+        }
+        return $arrHeader;
+    }
+
+    // ヘッダーを返す
+    function getTEXTHeader() {
+        $arrHeader = $this->getBaseHeader();
+        $arrHeader['Content-Type'] = "text/plain; charset=\"ISO-2022-JP\"";
+        $arrHeader['Content-Transfer-Encoding'] = "7bit";
+        return $arrHeader;
+    }
+
+    // ヘッダーを返す
+    function getHTMLHeader() {
+        $arrHeader = $this->getBaseHeader();
+        $arrHeader['Content-Type'] = "text/html; charset=\"ISO-2022-JP\"";
+        $arrHeader['Content-Transfer-Encoding'] = "ISO-2022-JP";
+        return $arrHeader;
+    }
+
+    //  TXTメール送信を実行する
+    function sendMail() {
+        $header = $this->getTEXTHeader();
         // メール送信
-        $result = $this->objMail->send($this->to, $header, $this->body);           
-		if (PEAR::isError($result)) { 
-			GC_Utils_Ex::gfPrintLog($result->getMessage());
-			GC_Utils_Ex::gfDebugLog($header);
-			return false;		
-		}
-		return true;
-	}
-	
-	// HTMLメール送信を実行する
-	function sendHtmlMail() {
-		$header = $this->getHTMLHeader();
+        $result = $this->objMail->send($this->to, $header, $this->body);
+        if (PEAR::isError($result)) {
+            GC_Utils_Ex::gfPrintLog($result->getMessage());
+            GC_Utils_Ex::gfDebugLog($header);
+            return false;
+        }
+        return true;
+    }
+
+    // HTMLメール送信を実行する
+    function sendHtmlMail() {
+        $header = $this->getHTMLHeader();
         // メール送信
-        $result = $this->objMail->send($this->to, $header, $this->body);           
-		if (PEAR::isError($result)) { 
-			GC_Utils_Ex::gfPrintLog($result->getMessage());
-			GC_Utils_Ex::gfDebugLog($header);	
-			return false;
-		}
-		return true;
-	}
+        $result = $this->objMail->send($this->to, $header, $this->body);
+        if (PEAR::isError($result)) {
+            GC_Utils_Ex::gfPrintLog($result->getMessage());
+            GC_Utils_Ex::gfDebugLog($header);
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * メーラーバックエンドに応じたパラメータを返す.
+     *
+     * @param string $backend Pear::Mail のバックエンド
+     * @return array メーラーバックエンドに応じたパラメータの配列
+     */
+    function getBackendParams($backend) {
+
+        switch ($backend) {
+        case "mail":
+            return array();
+            break;
+
+        case "sendmail":
+            $arrParams = array('sendmail_path' => '/usr/bin/sendmail',
+                               'sendmail_args' => '-i'
+                               );
+            break;
+
+        case "smtp":
+        default:
+            $arrParams = array(
+                               'host' => $this->host,
+                               'port' => $this->port
+                               );
+        }
+    }
 }
 ?>
Index: /branches/feature-module-update/data/class/helper/SC_Helper_Mail.php
===================================================================
--- /branches/feature-module-update/data/class/helper/SC_Helper_Mail.php	(revision 16322)
+++ /branches/feature-module-update/data/class/helper/SC_Helper_Mail.php	(revision 16503)
@@ -48,5 +48,5 @@
 
         // メール送信処理
-        $objSendMail = new SC_SendMail();
+        $objSendMail = new SC_SendMail_Ex();
         $from = $arrInfo['email03'];
         $error = $arrInfo['email04'];
@@ -123,5 +123,5 @@
 
         // メール送信処理
-        $objSendMail = new SC_SendMail();
+        $objSendMail = new SC_SendMail_Ex();
         $bcc = $arrInfo['email01'];
         $from = $arrInfo['email03'];
@@ -156,5 +156,5 @@
         $body = $objMailView->fetch($tplpath);
         // メール送信処理
-        $objSendMail = new SC_SendMail();
+        $objSendMail = new SC_SendMail_Ex();
         $to = mb_encode_mimeheader($to);
         $bcc = $arrInfo['email01'];
@@ -170,5 +170,5 @@
         $arrInfo = $objSiteInfo->data;
         // メール送信処理
-        $objSendMail = new SC_SendMail();
+        $objSendMail = new SC_SendMail_Ex();
         $bcc = $arrInfo['email01'];
         $from = $arrInfo['email03'];
Index: /branches/feature-module-update/data/module/Mail/mail.php
===================================================================
--- /branches/feature-module-update/data/module/Mail/mail.php	(revision 16503)
+++ /branches/feature-module-update/data/module/Mail/mail.php	(revision 16503)
@@ -0,0 +1,142 @@
+<?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Chuck Hagenbuch <chuck@horde.org>                            |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+
+/**
+ * internal PHP-mail() implementation of the PEAR Mail:: interface.
+ * @package Mail
+ * @version $Revision$
+ */
+class Mail_mail extends Mail {
+
+    /**
+     * Any arguments to pass to the mail() function.
+     * @var string
+     */
+    var $_params = '';
+
+    /**
+     * Constructor.
+     *
+     * Instantiates a new Mail_mail:: object based on the parameters
+     * passed in.
+     *
+     * @param array $params Extra arguments for the mail() function.
+     */
+    function Mail_mail($params = null)
+    {
+        /* The other mail implementations accept parameters as arrays.
+         * In the interest of being consistent, explode an array into
+         * a string of parameter arguments. */
+        if (is_array($params)) {
+            $this->_params = join(' ', $params);
+        } else {
+            $this->_params = $params;
+        }
+
+        /* Because the mail() function may pass headers as command
+         * line arguments, we can't guarantee the use of the standard
+         * "\r\n" separator.  Instead, we use the system's native line
+         * separator. */
+        if (defined('PHP_EOL')) {
+            $this->sep = PHP_EOL;
+        } else {
+            $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
+        }
+    }
+
+	/**
+     * Implements Mail_mail::send() function using php's built-in mail()
+     * command.
+     *
+     * @param mixed $recipients Either a comma-seperated list of recipients
+     *              (RFC822 compliant), or an array of recipients,
+     *              each RFC822 valid. This may contain recipients not
+     *              specified in the headers, for Bcc:, resending
+     *              messages, etc.
+     *
+     * @param array $headers The array of headers to send with the mail, in an
+     *              associative array, where the array key is the
+     *              header name (ie, 'Subject'), and the array value
+     *              is the header value (ie, 'test'). The header
+     *              produced from those values would be 'Subject:
+     *              test'.
+     *
+     * @param string $body The full text of the message body, including any
+     *               Mime parts, etc.
+     *
+     * @return mixed Returns true on success, or a PEAR_Error
+     *               containing a descriptive error message on
+     *               failure.
+     *
+     * @access public
+     */
+    function send($recipients, $headers, $body)
+    {
+        $this->_sanitizeHeaders($headers);
+
+        // 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 = '';
+        if (isset($headers['Subject'])) {
+            $subject = $headers['Subject'];
+            unset($headers['Subject']);
+        }
+
+        /*
+         * Also remove the To: header.  The mail() function will add its own
+         * To: header based on the contents of $recipients.
+         */
+        unset($headers['To']);
+
+        // Flatten the headers out.
+        $headerElements = $this->prepareHeaders($headers);
+        if (PEAR::isError($headerElements)) {
+            return $headerElements;
+        }
+        list(, $text_headers) = $headerElements;
+
+        /*
+         * We only use mail()'s optional fifth parameter if the additional
+         * parameters have been provided and we're not running in safe mode.
+         */
+        if (empty($this->_params) || ini_get('safe_mode')) {
+            $result = mail($recipients, $subject, $body, $text_headers);
+        } else {
+            $result = mail($recipients, $subject, $body, $text_headers,
+                           $this->_params);
+        }
+
+        /*
+         * If the mail() function returned failure, we need to create a
+         * PEAR_Error object and return it instead of the boolean result.
+         */
+        if ($result === false) {
+            $result = PEAR::raiseError('mail() returned failure');
+        }
+
+        return $result;
+    }
+
+}
Index: /branches/feature-module-update/data/module/Mail/null.php
===================================================================
--- /branches/feature-module-update/data/module/Mail/null.php	(revision 16503)
+++ /branches/feature-module-update/data/module/Mail/null.php	(revision 16503)
@@ -0,0 +1,60 @@
+<?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Phil Kernick <philk@rotfl.com.au>                            |
+// +----------------------------------------------------------------------+
+//
+// $Id$
+//
+
+/**
+ * Null implementation of the PEAR Mail:: interface.
+ * @access public
+ * @package Mail
+ * @version $Revision$
+ */
+class Mail_null extends Mail {
+
+    /**
+     * Implements Mail_null::send() function. Silently discards all
+     * mail.
+     *
+     * @param mixed $recipients Either a comma-seperated list of recipients
+     *              (RFC822 compliant), or an array of recipients,
+     *              each RFC822 valid. This may contain recipients not
+     *              specified in the headers, for Bcc:, resending
+     *              messages, etc.
+     *
+     * @param array $headers The array of headers to send with the mail, in an
+     *              associative array, where the array key is the
+     *              header name (ie, 'Subject'), and the array value
+     *              is the header value (ie, 'test'). The header
+     *              produced from those values would be 'Subject:
+     *              test'.
+     *
+     * @param string $body The full text of the message body, including any
+     *               Mime parts, etc.
+     *
+     * @return mixed Returns true on success, or a PEAR_Error
+     *               containing a descriptive error message on
+     *               failure.
+     * @access public
+     */
+    function send($recipients, $headers, $body)
+    {
+        return true;
+    }
+
+}
Index: /branches/feature-module-update/data/module/Mail/sendmail.php
===================================================================
--- /branches/feature-module-update/data/module/Mail/sendmail.php	(revision 16503)
+++ /branches/feature-module-update/data/module/Mail/sendmail.php	(revision 16503)
@@ -0,0 +1,155 @@
+<?php
+//
+// +----------------------------------------------------------------------+
+// | PHP Version 4                                                        |
+// +----------------------------------------------------------------------+
+// | Copyright (c) 1997-2003 The PHP Group                                |
+// +----------------------------------------------------------------------+
+// | This source file is subject to version 2.02 of the PHP license,      |
+// | that is bundled with this package in the file LICENSE, and is        |
+// | available at through the world-wide-web at                           |
+// | http://www.php.net/license/2_02.txt.                                 |
+// | If you did not receive a copy of the PHP license and are unable to   |
+// | obtain it through the world-wide-web, please send a note to          |
+// | license@php.net so we can mail you a copy immediately.               |
+// +----------------------------------------------------------------------+
+// | Author: Chuck Hagenbuch <chuck@horde.org>                            |
+// +----------------------------------------------------------------------+
+
+/**
+ * Sendmail implementation of the PEAR Mail:: interface.
+ * @access public
+ * @package Mail
+ * @version $Revision$
+ */
+class Mail_sendmail extends Mail {
+
+	/**
+     * The location of the sendmail or sendmail wrapper binary on the
+     * filesystem.
+     * @var string
+     */
+    var $sendmail_path = '/usr/sbin/sendmail';
+
+	/**
+     * Any extra command-line parameters to pass to the sendmail or
+     * sendmail wrapper binary.
+     * @var string
+     */
+    var $sendmail_args = '-i';
+
+	/**
+     * Constructor.
+     *
+     * Instantiates a new Mail_sendmail:: object based on the parameters
+     * passed in. It looks for the following parameters:
+     *     sendmail_path    The location of the sendmail binary on the
+     *                      filesystem. Defaults to '/usr/sbin/sendmail'.
+     *
+     *     sendmail_args    Any extra parameters to pass to the sendmail
+     *                      or sendmail wrapper binary.
+     *
+     * If a parameter is present in the $params array, it replaces the
+     * default.
+     *
+     * @param array $params Hash containing any parameters different from the
+     *              defaults.
+     * @access public
+     */
+    function Mail_sendmail($params)
+    {
+        if (isset($params['sendmail_path'])) {
+            $this->sendmail_path = $params['sendmail_path'];
+        }
+        if (isset($params['sendmail_args'])) {
+            $this->sendmail_args = $params['sendmail_args'];
+        }
+
+        /*
+         * Because we need to pass message headers to the sendmail program on
+         * the commandline, we can't guarantee the use of the standard "\r\n"
+         * separator.  Instead, we use the system's native line separator.
+         */
+        if (defined('PHP_EOL')) {
+            $this->sep = PHP_EOL;
+        } else {
+            $this->sep = (strpos(PHP_OS, 'WIN') === false) ? "\n" : "\r\n";
+        }
+    }
+
+	/**
+     * Implements Mail::send() function using the sendmail
+     * command-line binary.
+     *
+     * @param mixed $recipients Either a comma-seperated list of recipients
+     *              (RFC822 compliant), or an array of recipients,
+     *              each RFC822 valid. This may contain recipients not
+     *              specified in the headers, for Bcc:, resending
+     *              messages, etc.
+     *
+     * @param array $headers The array of headers to send with the mail, in an
+     *              associative array, where the array key is the
+     *              header name (ie, 'Subject'), and the array value
+     *              is the header value (ie, 'test'). The header
+     *              produced from those values would be 'Subject:
+     *              test'.
+     *
+     * @param string $body The full text of the message body, including any
+     *               Mime parts, etc.
+     *
+     * @return mixed Returns true on success, or a PEAR_Error
+     *               containing a descriptive error message on
+     *               failure.
+     * @access public
+     */
+    function send($recipients, $headers, $body)
+    {
+        $recipients = $this->parseRecipients($recipients);
+        if (PEAR::isError($recipients)) {
+            return $recipients;
+        }
+        $recipients = escapeShellCmd(implode(' ', $recipients));
+
+        $this->_sanitizeHeaders($headers);
+        $headerElements = $this->prepareHeaders($headers);
+        if (PEAR::isError($headerElements)) {
+            return $headerElements;
+        }
+        list($from, $text_headers) = $headerElements;
+
+        if (!isset($from)) {
+            return PEAR::raiseError('No from address given.');
+        } elseif (strpos($from, ' ') !== false ||
+                  strpos($from, ';') !== false ||
+                  strpos($from, '&') !== false ||
+                  strpos($from, '`') !== false) {
+            return PEAR::raiseError('From address specified with dangerous characters.');
+        }
+
+        $from = escapeShellCmd($from);
+        $mail = @popen($this->sendmail_path . (!empty($this->sendmail_args) ? ' ' . $this->sendmail_args : '') . " -f$from -- $recipients", 'w');
+        if (!$mail) {
+            return PEAR::raiseError('Failed to open sendmail [' . $this->sendmail_path . '] for execution.');
+        }
+
+        // Write the headers following by two newlines: one to end the headers
+        // section and a second to separate the headers block from the body.
+        fputs($mail, $text_headers . $this->sep . $this->sep);
+
+        fputs($mail, $body);
+        $result = pclose($mail);
+        if (version_compare(phpversion(), '4.2.3') == -1) {
+            // With older php versions, we need to shift the pclose
+            // result to get the exit code.
+            $result = $result >> 8 & 0xFF;
+        }
+
+        if ($result != 0) {
+            return PEAR::raiseError('sendmail returned error code ' . $result,
+                                    $result);
+        }
+
+        return true;
+    }
+
+}
