Simplify specifying the mailer configuration.
authorJan Schneider <jan@horde.org>
Fri, 31 Jul 2009 12:03:24 +0000 (14:03 +0200)
committerJan Schneider <jan@horde.org>
Fri, 31 Jul 2009 12:03:24 +0000 (14:03 +0200)
framework/Auth/lib/Horde/Auth/Signup.php
framework/Core/lib/Horde.php
framework/Mime/lib/Horde/Mime/Mail.php
framework/Release/lib/Horde/Release.php

index 1031abe..6840eb7 100644 (file)
@@ -134,7 +134,7 @@ class Horde_Auth_Signup
                 $conf['signup']['email'],
                 $conf['signup']['email'],
                 Horde_Nls::getCharset());
-            $mail->send($conf['mailer']['type'], $conf['mailer']['params']);
+            $mail->send(Horde::getMailerConfig());
         }
     }
 
index 508c47b..83e23a0 100644 (file)
@@ -897,7 +897,7 @@ HTML;
             $mail_params['password'] = Horde_Auth::getCredential('password');
         }
 
-        return array($mail_driver, $mail_params);
+        return array('type' => $mail_driver, 'params' => $mail_params);
     }
 
     /**
index 847295a..aecac73 100644 (file)
@@ -407,16 +407,16 @@ class Horde_Mime_Mail
      * documentation.
      * @link http://pear.php.net/Mail
      *
-     * @param string $driver   The Mail driver to use.
-     * @param array $params    Any parameters necessary for the Mail driver.
+     * @param array $config    A hash with the Mail driver to use in 'type' and
+     *                         any parameters necessary for the Mail driver in
+     *                         'params'.
      * @param boolean $resend  If true, the message id and date are re-used;
      *                         If false, they will be updated.
      * @param boolean $flowed  Send message in flowed text format.
      *
      * @throws Horde_Mime_Exception
      */
-    public function send($driver = null, $params = array(), $resend = false,
-                         $flowed = true)
+    public function send($config, $resend = false, $flowed = true)
     {
         /* Add mandatory headers if missing. */
         if (!$resend || !$this->_headers->getValue('Message-ID')) {
@@ -470,11 +470,11 @@ class Horde_Mime_Mail
         }
 
         /* Check mailer configuration. */
-        if (!empty($driver)) {
-            $this->_mailer_driver = $driver;
+        if (!empty($config['type'])) {
+            $this->_mailer_driver = $config['type'];
         }
-        if (!empty($params)) {
-            $this->_mailer_params = $params;
+        if (!empty($config['params'])) {
+            $this->_mailer_params = $config['params'];
         }
 
         /* Send message. */
index f93b298..f2157c5 100644 (file)
@@ -653,7 +653,7 @@ class Horde_Release
         $mail = new Horde_Mime_Mail();
         $mail->setBody($body, 'iso-8859-1', false);
         $mail->addHeaders($headers);
-        $result = $mail->send($this->_options['mailer']['type'], $this->_options['mailer']['params']);
+        $result = $mail->send(array('type' => $this->_options['mailer']['type'], 'params' => $this->_options['mailer']['params']));
         if (is_a($result, 'PEAR_Error')) {
             print $result->getMessage() . "\n";
         }