[turba] importing vcards

Cliff Green green@UMDNJ.EDU
Mon, 29 Jul 2002 18:39:30 -0400


We were documenting how users can import their Pine addressbooks into turba
and found that Pine (unix and PC) exports the email address to a vcard as:
"Full Name <address@domain.name>" (my quote marks).

The result is that turba imports the email address as above, and uses 
'Full Name <"Full Name <address"@domain.name>>' (my single quotes) in the
To: header.  Trouble is, when one tries to send mail to that address, it is
returned by sendmail with an error: "unable to add recipient [@localhost]:
553 <@localhost>... User address required."

I have no idea if vcards created by other MUAs do the same thing.

I've applied a small patch against turba/data.php to trim off the leading
fullname and trailing angle bracket if they're there, and now these import
correctly. It seems to work here.  See below for the patch.

This works against data.php versions 1.26 (2002/07/12) and 1.24
(2002/06/19), though the line references below are for 1.26.

<vcard import patch begins>
--- data.php.dist       Mon Jul 29 12:45:41 2002
+++ data.php    Mon Jul 29 14:06:53 2002
@@ -274,7 +274,11 @@
 
                                 case 'EMAIL':
                                     if (isset($item['params']['PREF']) || \
!isset($hash['email'])) {
-                                        $hash['email'] = $vcf->read($item);
+                                        $stuff_to_remove = array("/^.*</",
\ "/>$/");
+                                        $blank_to_insert = array("", "");
+                                        $tmpitem = $vcf->read($item);
+                                        $tmpitem = \
preg_replace($stuff_to_remove, $blank_to_insert, $tmpitem);
+                                        $hash['email'] = $tmpitem;
                                     }
                                     break;
<vcard import patch ends>

c
-- 
Cliff Green
Academic Computing Services - UMDNJ
Signature under NDA