[imp] [RELENG_3:] Character enconding problem when saving drafts

Joerg Friedrich Joerg.Dieter.Friedrich at uni-konstanz.de
Wed Sep 17 01:07:08 PDT 2003


Hi,

attached you'll find a patch to this problem.
I had no time to checkout the latest cvs!
Please recheck my patch before apply!
BTW: Quick'n'Dirty-Patch, since I didn't find coding standards, maybe
variable renaming required.



Joerg Friedrich schrieb am Mittwoch, 17. September 2003 um 00:16:35 +0200:
> Hi, 
> 
> one of our users encountered a problem when saving a msg as draft.
> Our IMAP server (cyrus) replaces every non-7-Bit-Chars in the header by
> a 'X'. So every draft containing 8-bit-chars i.e in subject gets messed
> up when appended to the mailbox via imap_append.
> 
> the appending to the send-mail-box when sending the mail is not
> affected, since there is a "$headers = $mime->header($headers);" which
> does the right encoding. 
> 
> I think the only way is to rewrite the 'case SAVE_DRAFT' section in
> compose.php. I'll look at it tomorrow. 
> -- 
> Jörg Friedrich
> 
> -- 
> IMP mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: imp-unsubscribe at lists.horde.org

-- 
Jörg Friedrich
-------------- next part --------------
--- compose.php.orig	2003-09-17 10:02:28.000000000 +0200
+++ compose.php	2003-09-17 10:01:10.000000000 +0200
@@ -943,34 +943,44 @@
 
          $from = $identity->getFromLine(Horde::getFormData('identity'), Horde::getFormData('from'));
 
-         $hdrs = 'Date: ' . date('r') . "\n";
+         $hdrs['Date'] = date('r');
          if (!empty($from)) {
-             $hdrs .= "From: $from\n";
+             $hdrs['From'] = $from;
          }
          if (($to = Horde::getFormData('to'))) {
              $to = MIME::encodeAddress(format_addresses($to), null, $imp['maildomain']);
-             $hdrs .= "To: $to\n";
+             $hdrs['To'] = $to;
          }
          if (($cc = Horde::getFormData('cc'))) {
              $cc = MIME::encodeAddress(format_addresses($cc), null, $imp['maildomain']);
-             $hdrs .= "Cc: $cc\n";
+             $hdrs['Cc'] = $cc;
          }
          if (($bcc = Horde::getFormData('bcc'))) {
              $bcc = MIME::encodeAddress(format_addresses($bcc), null, $imp['maildomain']);
-             $hdrs .= "Bcc: $bcc\n";
+             $hdrs['Bcc'] = $bcc;
          }
          if (($sub = Horde::getFormData('subject'))) {
-             $hdrs .= "Subject: $sub\n";
+             $hdrs['Subject'] = $sub;
          }
          if (isset($mime)) {
              $env = $mime->header();
              foreach ($env as $key => $val) {
-                 $hdrs .= $key . ': ' . $val . "\n";
+                 $hdrs[$key] = $val;
              }
          }
-         $hdrs .= "\n";
 
-         $body = $hdrs . $body;
+         $hdrs = $mime->header($hdrs);
+
+	 reset($hdrs);
+	 $fcc = '';
+	 foreach ($hdrs as $key => $val) {
+	     if ($key != 'recipients') {
+		 $fcc .= $key . ': ' . $val . "\n";
+	     }
+	 }
+	 $fcc .= "\n";
+
+         $body = $fcc . $body;
 
          // Make absolutely sure there are no bare newlines.
          $body = preg_replace("|([^\r])\n|", "\\1\r\n", $body);


More information about the imp mailing list