Attaching vCards to Email Messages

Like any good document, vCards may be attached to email messages. Some MUAs give them special handling. Netscape Mail, for example, shows a nicely formatted vCard when it receives one (as of vCard 2.1). NetscapeMail also gives a button to add the vCard to its address book.

The two vCard versions are attached with different MIME types, which bears some discussion.

Version 2.1 vCards are typically attached to messages using the custom text/x-vcard MIME type. This custom descriptor was agreed to by several vendors before vCard was put forward as a proposed standard. Version 3.0 vCards use the text/directory MIME type, which is also a proposed Internet standard (see RFC 2425, “A MIME Content-Type for Directory Information”).

To see how existing Version 2.1 vCards are attached, let’s look at a real vCard as implemented by Netscape. The following MIME entity shows a content type of text/x-vcard with default 7-bit US-ASCII text.

Netscape has made some choices here; the card includes the optional VERSION type, which helps to distinguish it from later implementations. It adds a few custom types as well: x-mozilla-cpt and x-mozilla-html, used by the NetscapeMail MUA when parsing and creating the vCard. Interestingly, Netscape allows one to place HTML inside some textual values, which would be parsed by their MUA but probably not by other MUAs. This is why you see an HTML image (IMG) tag in the ORG line in the following MIME entity. Such use of a vCard is nonstandard ...

Get Programming Internet Email now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.