Changeset 5852c14d in github


Ignore:
Timestamp:
Jun 11, 2010 9:57:02 AM (3 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
0133e6b
Parents:
93e3ae1
Message:
  • Add option to set separate footer for HTML messages (#1486660)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    r349a8e3 r5852c14d  
    22=========================== 
    33 
     4- Add option to set separate footer for HTML messages (#1486660) 
    45- Add real SMTP error description to displayed error messages (#1485927) 
    56- Fix some IMAP errors handling when opening the message (#1485443) 
  • config/main.inc.php.dist

    r6a642d1 r5852c14d  
    225225// paths are relative to the RoundCube root folder 
    226226$rcmail_config['generic_message_footer'] = ''; 
     227 
     228// path to a text file which will be added to each sent HTML message 
     229// paths are relative to the RoundCube root folder 
     230$rcmail_config['generic_message_footer_html'] = ''; 
    227231 
    228232// add a received header to outgoing mails containing the creators IP and hostname 
  • program/steps/mail/sendmail.inc

    rac8edbe r5852c14d  
    385385        '<blockquote type="cite" style="'.$bstyle.'">', $message_body); 
    386386  } 
     387 
    387388  // generic footer for all messages 
    388   if (!empty($CONFIG['generic_message_footer'])) { 
     389  if ($isHtml && !empty($CONFIG['generic_message_footer_html'])) { 
     390      $footer = file_get_contents(realpath($CONFIG['generic_message_footer_html'])); 
     391      $footer = rcube_charset_convert($footer, RCMAIL_CHARSET, $message_charset); 
     392  } 
     393  else if (!empty($CONFIG['generic_message_footer'])) { 
    389394    $footer = file_get_contents(realpath($CONFIG['generic_message_footer'])); 
    390395    $footer = rcube_charset_convert($footer, RCMAIL_CHARSET, $message_charset); 
    391   } 
     396    if ($isHtml) 
     397      $footer = '<pre>'.$footer.'</pre>'; 
     398  } 
     399  if ($footer) 
     400    $message_body .= "\r\n" . $footer; 
    392401} 
    393402 
     
    423432    array('body' => $message_body, 'type' => 'html', 'message' => $MAIL_MIME)); 
    424433 
    425   $MAIL_MIME->setHTMLBody($plugin['body'] . ($footer ? "\r\n<pre>".$footer.'</pre>' : '')); 
     434  $MAIL_MIME->setHTMLBody($plugin['body']); 
    426435 
    427436  // add a plain text version of the e-mail as an alternative part. 
    428437  $h2t = new html2text($plugin['body'], false, true, 0); 
    429   $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n") . ($footer ? "\r\n".$footer : ''); 
     438  $plainTextPart = rc_wordwrap($h2t->get_text(), $LINE_LENGTH, "\r\n"); 
    430439  $plainTextPart = wordwrap($plainTextPart, 998, "\r\n", true); 
    431   if (!strlen($plainTextPart)) { 
     440  if (!$plainTextPart) { 
    432441    // empty message body breaks attachment handling in drafts  
    433442    $plainTextPart = "\r\n";  
     
    448457} 
    449458else { 
    450   if ($footer) 
    451     $message_body .= "\r\n" . $footer; 
    452    
     459  $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body', 
     460    array('body' => $message_body, 'type' => 'plain', 'message' => $MAIL_MIME)); 
     461 
     462  $message_body = $plugin['body']; 
     463 
    453464  // compose format=flowed content if enabled and not a reply message 
    454465  if (empty($_SESSION['compose']['reply_msgid']) && ($flowed = $RCMAIL->config->get('send_format_flowed', true))) 
     
    456467  else 
    457468    $message_body = rc_wordwrap($message_body, $LINE_LENGTH, "\r\n"); 
    458    
     469 
    459470  $message_body = wordwrap($message_body, 998, "\r\n", true); 
    460471  if (!strlen($message_body)) {  
     
    463474  } 
    464475 
    465   $plugin = $RCMAIL->plugins->exec_hook('outgoing_message_body', 
    466     array('body' => $message_body, 'type' => 'plain', 'message' => $MAIL_MIME)); 
    467  
    468   $MAIL_MIME->setTXTBody($plugin['body'], false, true); 
     476  $MAIL_MIME->setTXTBody($message_body, false, true); 
    469477} 
    470478 
Note: See TracChangeset for help on using the changeset viewer.