<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>Compose window does not properly handle escaped quotes in To address</title> 
  <pubDate>Thu, 09 Apr 2026 19:39:42 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/2168</link> 
  <atom:link rel="self" type="application/rss+xml" title="Compose window does not properly handle escaped quotes in To address" href="https://bugs.horde.org/ticket/2168/rss" /> 
  <description>Compose window does not properly handle escaped quotes in To address</description> 
 
   
   
  <item> 
   <title>An address of the form 



&quot;Adrian \&quot;The Man\&quot; Hosey&quot; &lt;alh@i</title> 
   <description>An address of the form 



&quot;Adrian \&quot;The Man\&quot; Hosey&quot; &lt;alh@indiana.edu&gt;



is legal by RFC2822 Section 3.2.5, but Imp has trouble with it. If you attempt to reply to a message like that, it passes the address validator, but it tries to send to &quot;&quot; (i.e. a blank) and the message will be bounced by the MTA.

</description> 
   <pubDate>Wed, 22 Jun 2005 19:38:42 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/2168#t9277</link> 
  </item> 
   
  <item> 
   <title>&gt; An address of the form

&gt;

&gt; &quot;Adrian \&quot;The Man\&quot; Hosey&quot; &lt;a</title> 
   <description>&gt; An address of the form

&gt;

&gt; &quot;Adrian \&quot;The Man\&quot; Hosey&quot; &lt;alh@indiana.edu&gt;

&gt;

&gt; is legal by RFC2822 Section 3.2.5, but Imp has trouble with it. If 

&gt; you attempt to reply to a message like that, it passes the address 

&gt; validator, but it tries to send to &quot;&quot; (i.e. a blank) and the message 

&gt; will be bounced by the MTA.

&gt;



I think there are two bugs causing this. One is in Mail::RFC822, in _validateQuotedString(). This regex:



return !(preg_match(&#039;/(.)[\x0D\\\\&quot;]/&#039;, $qstring, $matches) &amp;&amp; $matches[1] != &#039;\\&#039;);



does not sucessfully distinguish between &quot;Adrian &quot;The Man&quot; Hosey&quot; (illegal) and &quot;Adrian \&quot;The Man\&quot; Hosey&quot; (legal). Rather than continue to torture the regex, I added this right before the regex:



        $qstring_ary = explode(&#039;\&quot;&#039;, $qstring);

        $qstring = implode(&#039;&#039;, $qstring_ary);



pressing out any \&quot; pairs, because we know they&#039;re okay.



The other bug is in Horde::MIME, in _rfc822Encode(). This line:



return &#039;&quot;&#039; . str_replace(&#039;&quot;&#039;, &#039;\\&quot;&#039;, str_replace(&#039;\\&#039;, &#039;\\\\&#039;, $str)) . &#039;&quot;&#039;;



doesn&#039;t recognize that a \&quot; pair inside a quoted-string doesn&#039;t need to be escaped again.

</description> 
   <pubDate>Thu, 23 Jun 2005 20:56:58 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/2168#t9318</link> 
  </item> 
   
  <item> 
   <title>Bug 2142 is a duplicate of this bug.</title> 
   <description>Bug 2142 is a duplicate of this bug.</description> 
   <pubDate>Fri, 24 Jun 2005 04:44:17 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/2168#t9335</link> 
  </item> 
   
  <item> 
   <title>The MIME _rfc822Encode function has been fixed in Horde 3.0.</title> 
   <description>The MIME _rfc822Encode function has been fixed in Horde 3.0.5 and HEAD.

The Mail_RFC822 function has already been fixed in the PEAR package by Chuck.  See:

http://pear.php.net/bugs/bug.php?id=2931</description> 
   <pubDate>Fri, 24 Jun 2005 05:04:13 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/2168#t9336</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
