Internationalized Email Support

Hi there!

Today, we committed a big change into VMime codebase. We implemented preliminary support for RFC-6532 (Internationalized Email Headers), which is the (future) replacement for RFC-2047. We added support for IDN (Internationalized Domain Name) and EAI (Email Address Internationalization).

As a lot of MUAs and MSAs do not support this yet, the feature is not enabled by default (and, to be honest, we need to test this thoroughly in VMime before using it in production code). To enable it from your code, just configure the default generation context:

vmime::generationContext::getDefaultContext()
    .setInternationalizedEmailSupport(true);

In the meantime, we also added message generation/parsing context and charset conversion options, to provide a better control to the user on how the messages are parsed/generated. Have a look at Doxygen-generated documentation to know more about this.

New feature: get parsed message from store

Hi VMime users!

Let’s focus today on a new feature in VMime 0.9. Until now, when you wanted to “explore” the contents of a vmime::net::message (that is, a message hosted on a IMAP or a POP3 store), you had to extract it entirely, or to use low-level fetch() and extract() functions on the message object.

Since the current development release of May 18th, there is a new helper function that will let you access the remote message like a “normal” vmime::message, and actually download the message data only when it is required (this only works for IMAP).

// Connect to the IMAP store
vmime::ref <vmime::net::session> sess = vmime::net::session::create();

vmime::utility::url storeURL("imap://username:password@imap.example.com");

vmime::ref <vmime::net::store> store = sess->getStore(storeURL);
store->connect();

// Open the INBOX
vmime::ref <vmime::net::folder> folder = store->getDefaultFolder();
folder->open(vmime::net::folder::MODE_READ_WRITE);

// Get the first message in the INBOX
vmime::ref <vmime::net::message> msg = f->getMessage(1);

// Construct the parsed message (a few data, header and structure,
// is actually downloaded from the IMAP server)
vmime::ref <vmime::message> parsedMsg = msg->getParsedMessage();

// Here, extract() will actually download message data from the server
vmime::utility::outputStreamAdapter out(std::cout);
parsedMsg->getBody()->extract(out);

That’s all folks! Update your source tree to the latest SVN head to enjoy this new feature.