[Svn] r3744 - in trunk/roundcubemail: . config program/steps/mail

trac at roundcube.net trac at roundcube.net
Fri Jun 11 15:57:03 CEST 2010


Author: alec
Date: 2010-06-11 08:57:02 -0500 (Fri, 11 Jun 2010)
New Revision: 3744

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/config/main.inc.php.dist
   trunk/roundcubemail/program/steps/mail/sendmail.inc
Log:
- Add option to set separate footer for HTML messages (#1486660)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-06-11 13:14:38 UTC (rev 3743)
+++ trunk/roundcubemail/CHANGELOG	2010-06-11 13:57:02 UTC (rev 3744)
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Add option to set separate footer for HTML messages (#1486660)
 - Add real SMTP error description to displayed error messages (#1485927)
 - Fix some IMAP errors handling when opening the message (#1485443)
 - Fix related parts aren't displayed when got mimetype other than image/* (#1486432)

Modified: trunk/roundcubemail/config/main.inc.php.dist
===================================================================
--- trunk/roundcubemail/config/main.inc.php.dist	2010-06-11 13:14:38 UTC (rev 3743)
+++ trunk/roundcubemail/config/main.inc.php.dist	2010-06-11 13:57:02 UTC (rev 3744)
@@ -225,6 +225,10 @@
 // paths are relative to the RoundCube root folder
 $rcmail_config['generic_message_footer'] = '';
 
+// path to a text file which will be added to each sent HTML message
+// paths are relative to the RoundCube root folder
+$rcmail_config['generic_message_footer_html'] = '';
+
 // add a received header to outgoing mails containing the creators IP and hostname
 $rcmail_config['http_received_header'] = false;
 

Modified: trunk/roundcubemail/program/steps/mail/sendmail.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/sendmail.inc	2010-06-11 13:14:38 UTC (rev 3743)
+++ trunk/roundcubemail/program/steps/mail/sendmail.inc	2010-06-11 13:57:02 UTC (rev 3744)
@@ -384,11 +384,20 @@
     $message_body = preg_replace('/<blockquote>/',
 	'<blockquote type="cite" style="'.$bstyle.'">', $message_body);
   }
+
   // generic footer for all messages
-  if (!empty($CONFIG['generic_message_footer'])) {
+  if ($isHtml && !empty($CONFIG['generic_message_footer_html'])) {
+      $footer = file_get_contents(realpath($CONFIG['generic_message_footer_html']));
+      $footer = rcube_charset_convert($footer, RCMAIL_CHARSET, $message_charset);
+  }
+  else if (!empty($CONFIG['generic_message_footer'])) {
     $footer = file_get_contents(realpath($CONFIG['generic_message_footer']));
     $footer = rcube_charset_convert($footer, RCMAIL_CHARSET, $message_charset);
+    if ($isHtml)
+      $footer = '<pre>'.$footer.'</pre>';
   }
+  if ($footer)
+    $message_body .= "\r\n" . $footer;
 }
 
 // set line length for body wrapping
@@ -422,13 +431,13 @@
   $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body',
     array('body' => $message_body, 'type' => 'html', 'message' => $MAIL_MIME));
 
-  $MAIL_MIME->setHTMLBody($plugin['body'] . ($footer ? "\r\n<pre>".$footer.'</pre>' : ''));
+  $MAIL_MIME->setHTMLBody($plugin['body']);
 
   // add a plain text version of the e-mail as an alternative part.
   $h2t = new html2text($plugin['body'], false, true, 0);
-  $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n") . ($footer ? "\r\n".$footer : '');
+  $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n");
   $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true);
-  if (!strlen($plainTextPart)) {
+  if (!$plainTextPart) {
     // empty message body breaks attachment handling in drafts 
     $plainTextPart = "\r\n"; 
   }
@@ -447,25 +456,24 @@
   $message_body = rcmail_fix_emoticon_paths($MAIL_MIME);
 }
 else {
-  if ($footer)
-    $message_body .= "\r\n" . $footer;
-  
+  $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body',
+    array('body' => $message_body, 'type' => 'plain', 'message' => $MAIL_MIME));
+
+  $message_body = $plugin['body'];
+
   // compose format=flowed content if enabled and not a reply message
   if (empty($_SESSION['compose']['reply_msgid']) && ($flowed = $RCMAIL->config->get('send_format_flowed', true)))
     $message_body = rcube_message::format_flowed($message_body, $LINE_LENGTH);
   else
     $message_body = rc_wordwrap($message_body, $LINE_LENGTH, "\r\n");
-  
+
   $message_body = wordwrap($message_body, 998, "\r\n", true);
   if (!strlen($message_body)) { 
     // empty message body breaks attachment handling in drafts 
     $message_body = "\r\n"; 
   }
 
-  $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body',
-    array('body' => $message_body, 'type' => 'plain', 'message' => $MAIL_MIME));
-
-  $MAIL_MIME->setTXTBody($plugin['body'], false, true);
+  $MAIL_MIME->setTXTBody($message_body, false, true);
 }
 
 // add stored attachments, if any

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list