[imp] Problem with quotes in name (Imp 3.1)

Viljo Viitanen vviitane+mail.imp at mappi.helsinki.fi
Tue Oct 15 18:57:40 PDT 2002


The problem is: if I put quotes in my name in imp (like Viljo "Something"
Viitanen), really bad things happen. In my environment with the real
sendmail as mta, the mail gets sent without a from field.

I tracked this down to PEAR Mail_RFC822::parseAddressList which the PEAR
Sendmail function uses (which is used by Imp). It completely fails to parse
the address if it is of the form "Viljo \"Something\" Viitanen" <foo at bar>.
What is strange however, is that "\"Viljo\" Viitanen" <foo at bar> parses okay.

I'm using Imp 3.1/Horde 2.1, and some version of PEAR (can't remember which
exactly). However, I checked the PEAR cvs repository, and the code in
RFC822.php hasn't changed.

The following code

<pre>
<?php
include_once 'Mail/RFC822.php';
 
$address = imap_rfc822_write_address("viljo.viitanen","helsinki.fi", 
"\"Viljo\" Viitanen");
$rfc822  = new Mail_RFC822($address, 'helsinki.fi', TRUE); 
$addresses = $rfc822->parseAddressList();
print_r($addresses);
 
$address2 = imap_rfc822_write_address("viljo.viitanen","helsinki.fi", "Viljo
\"Test\" Viitanen");
$rfc8222  = new Mail_RFC822($address2, 'helsinki.fi', TRUE);
$addresses2 = $rfc8222->parseAddressList();
print_r($addresses2);
?>

produces

Array
(
    [0] => stdClass Object
        (
            [personal] => "\"Viljo\" Viitanen"
            [comment] => Array
                (
                )

            [mailbox] => viljo.viitanen
            [host] => helsinki.fi
        )

)
Array
(
    [0] => "Viljo \"Test\" Viitanen" 
)


-- 
Viljo Viitanen


More information about the imp mailing list