Simplify specifying the mailer configuration.
authorJan Schneider <jan@horde.org>
Fri, 31 Jul 2009 12:04:44 +0000 (14:04 +0200)
committerJan Schneider <jan@horde.org>
Fri, 31 Jul 2009 12:04:44 +0000 (14:04 +0200)
ansel/img/ecard.php
ansel/lib/Report/mail.php
imp/lib/IMP.php
imp/lib/Mime/Viewer/Pgp.php
kronolith/lib/Kronolith.php
kronolith/scripts/agenda.php
nag/lib/Nag.php

index f5fcb8a..4e344d1 100644 (file)
@@ -84,8 +84,7 @@ case 'send':
     $alt->setBasePart($alternative);
 
     /* Send. */
-    list($mail_driver, $mail_params) = Horde::getMailerConfig();
-    $result = $alt->send($mail_driver, $mail_params);
+    $result = $alt->send(Horde::getMailerConfig());
     if (is_a($result, 'PEAR_Error')) {
         $notification->push(sprintf(_("There was an error sending your message: %s"), $result->getMessage()), 'horde.error');
     } else {
index cf32e9b..7b1b360 100644 (file)
@@ -36,7 +36,6 @@ class Ansel_Report_mail extends Ansel_Report {
         //FIXME: This address should be configurable
         $mail->addHeader('Sender',
                          'horde-problem@' . $conf['report_content']['maildomain']);
-        list($mail_driver, $mail_params) = Horde::getMailerConfig();
-        return $mail->send($mail_driver, $mail_params);
+        return $mail->send(Horde::getMailerConfig());
     }
 }
index 5c9a97e..644e4e6 100644 (file)
@@ -837,6 +837,7 @@ class IMP
      */
     static public function folderPref($folder, $append)
     {
+        if (!isset($GLOBALS['imp_imap'])) var_dump(debug_backtrace());
         $def_ns = $GLOBALS['imp_imap']->defaultNamespace();
         $empty_ns = $GLOBALS['imp_imap']->getNamespace('');
 
index fe5fc1f..d0aec8e 100644 (file)
@@ -355,13 +355,16 @@ class IMP_Horde_Mime_Viewer_Pgp extends Horde_Mime_Viewer_Driver
 
                 $icon = Horde::img('alerts/success.png', _("Success"), null, $graphicsdir);
                 $sig_text = $sig_result->message;
+                $success = true;
             } catch (Horde_Exception $e) {
-                $icon = Horde::img('alerts/warning.png', _("Warning"), null, $graphicsdir);
+                $icon = Horde::img('alerts/error.png', _("Error"), null, $graphicsdir);
                 $sig_text = $e->getMessage();
+                $success = false;
             }
 
             $ret[$base_id]['status'][] = array(
                 'icon' => $icon,
+                'success' => $success,
                 'text' => array(
                     Horde_Text_Filter::filter($sig_text, 'text2html', array('parselevel' => Horde_Text_Filter_Text2html::NOHTML))
                 )
index 3d1d383..11a0eb2 100644 (file)
@@ -1217,14 +1217,6 @@ class Kronolith
         $myemail = explode('@', $myemail);
         $from = Horde_Mime_Address::writeAddress($myemail[0], isset($myemail[1]) ? $myemail[1] : '', $ident->getValue('fullname'));
 
-        $mail_driver = $conf['mailer']['type'];
-        $mail_params = $conf['mailer']['params'];
-        if ($mail_driver == 'smtp' && $mail_params['auth'] &&
-            empty($mail_params['username'])) {
-            $mail_params['username'] = Horde_Auth::getAuth();
-            $mail_params['password'] = Horde_Auth::getCredential('password');
-        }
-
         $share = &$GLOBALS['kronolith_shares']->getShare($event->getCalendar());
 
         foreach ($attendees as $email => $status) {
@@ -1312,7 +1304,7 @@ class Kronolith
             $mail->addMimePart($ics);
 
             try {
-                $mail->send($mail_driver, $mail_params);
+                $mail->send(Horde::getMailerConfig());
                 $notification->push(
                     sprintf(_("The event notification to %s was successfully sent."), $recipient),
                     'horde.success'
@@ -1403,14 +1395,6 @@ class Kronolith
             return;
         }
 
-        $mail_driver = $conf['mailer']['type'];
-        $mail_params = $conf['mailer']['params'];
-        if ($mail_driver == 'smtp' && $mail_params['auth'] &&
-            empty($mail_params['username'])) {
-            $mail_params['username'] = Horde_Auth::getAuth();
-            $mail_params['password'] = Horde_Auth::getCredential('password');
-        }
-
         foreach ($addresses as $lang => $twentyFour) {
             Horde_Nls::setLang($lang);
 
@@ -1446,10 +1430,11 @@ class Kronolith
                                                      implode(',', $df_recipients),
                                                      $from,
                                                      Horde_Nls::getCharset());
+                    $mail->addHeader('User-Agent', 'Kronolith ' . $GLOBALS['registry']->getVersion());
                     $mime_mail->setBody($message, Horde_Nls::getCharset(), true);
                     Horde::logMessage(sprintf('Sending event notifications for %s to %s', $event->title, implode(', ', $df_recipients)), __FILE__, __LINE__, PEAR_LOG_DEBUG);
                     try {
-                        $mime_mail->send($mail_driver, $mail_params, false, false);
+                        $mime_mail->send(Horde::getMailerConfig(), false, false);
                     } catch (Horde_Mime_Exception $e) {}
                 }
             }
index 7b8238c..ff0da1a 100755 (executable)
@@ -147,15 +147,8 @@ function send_agendas()
                                          $email,
                                          $GLOBALS['conf']['reminder']['from_addr'],
                                          Horde_Nls::getCharset());
+        $mime_mail->addHeader('User-Agent', 'Kronolith ' . $registry->getVersion());
 
-        $mail_driver = $GLOBALS['conf']['mailer']['type'];
-        $mail_params = $GLOBALS['conf']['mailer']['params'];
-        if ($mail_driver == 'smtp' && $mail_params['auth'] &&
-            empty($mail_params['username'])) {
-            Horde::logMessage('Agenda Notifications don\'t work with user based SMTP authentication.',
-                              __FILE__, __LINE__, PEAR_LOG_ERR);
-            return;
-        }
         $pad = max(Horde_String::length(_("All day")) + 2, $twentyFour ? 6 : 8);
 
         $message = sprintf(_("Your daily agenda for %s"),
@@ -177,7 +170,7 @@ function send_agendas()
         Horde::logMessage(sprintf('Sending daily agenda to %s', $email),
                           __FILE__, __LINE__, PEAR_LOG_DEBUG);
         try {
-            $mime_mail->send($mail_driver, $mail_params, false, false);
+            $mime_mail->send(Horde::getMailerConfig(), false, false);
         } catch (Horde_Mime_Exception $e) {}
     }
 }
index 6360f93..f85a47b 100644 (file)
@@ -815,7 +815,6 @@ class Nag
             return;
         }
 
-        list($mail_driver, $mail_params) = Horde::getMailerConfig();
         $mail = new Horde_Mime_Mail();
         $mail->addHeader('User-Agent', 'Nag ' . $GLOBALS['registry']->getVersion());
         $mail->addHeader('Precedence', 'bulk');
@@ -965,7 +964,7 @@ class Nag
                     Horde::logMessage(sprintf('Sending event notifications for %s to %s',
                                               $task->name, implode(', ', $df_recipients)),
                                       __FILE__, __LINE__, PEAR_LOG_INFO);
-                    $sent = $mail->send($mail_driver, $mail_params);
+                    $sent = $mail->send(Horde::getMailerConfig());
                     if (is_a($sent, 'PEAR_Error')) {
                         return $sent;
                     }