Neat geek thing: automatic vCard from contact form

In an attempt to control the amount of spam I receive, I don't publish my email address anywhere. That's worked moderately well, except for my email.com address which has spread into the world as both a recipient, as well as sender, of spam.

Anyway, so as I developed this site I decided to create my own "contact" form, nicely linked at /contact.

The form itself is pretty generic, though if you use MSIE or Safari it's supposed to magically fill in a bunch of fields (this seems to randomly work). But behind the scenes I did what, if I do say so myself, was a neat hack.

See, when the form processes the message (using PHP, which I need to rave about some other time) it creates a multi-part MIME message which is then sent as email to me.

The three MIME sections are a text/html section (which basically looks like the page at /contact), an application/xml section (which encodes all of the data in XML using a pseudo-DTD I concocted), and a text/directory section.

It's this last section which is the neat hack. text/directory is the MIME type for vCards, basically electronic business cards. Microsoft Outlook can import and export them as can a variety of other applications. That said, they're not that widely known or used. Anyway, by encoding all of the contact information in a vCard and attaching it to the email, I'm able to click on it and automatically add (or update) an entry in my address book.

Yesterday I got the first "live" vCard from Dan, whom I worked with at IBM many years ago. Dan sent a brief update and link to his family newsletter for the year. I clicked on the vCard and voila, Outlook asked if it could update the entry in the address book, and did. Only problem is that the email indicates Dan lives in Brooklyn, NY which I know isn't the case, so I think there's some debugging code hardcoded in somewhere. I'll check when I'm online again.

Anyway, thanks Dan for dropping by and letting me bask in my geekness for a bit this weekend (even if the code doesn't work 100%, I'm sure I wouldn't have had the error had I been using Case/390 for PHP).

«Inauspicious start to the year | Main | So, I flew»

Slightly acerbic and eccentric dog walker who masquerades as a web developer and occasional CTO.

Spent five years running the technology side of the circus known as www.ibm.com.

More about me here.

Archives

Get updates via email

Enter your email address:

Delivered by FeedBurner