We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Convert vcard to mhtml

I am able to convert the contact to mhtml but some fields are always empty

Postal Address:
Business:
Email:
Email Display As:

I can see contact email by contact.getElectronicAddresses().getEmail1().getEmailAddress(); , but its not present at result mhtml.

Is there any way to convert contacts to mhtml correctly

MapiContact contact = MapiContact.fromVCard(in);
ByteArrayOutputStream osBuff = new ByteArrayOutputStream();
MapiContactElectronicAddressPropertySet addresses = contact.getElectronicAddresses();
addresses.setDefaultEmailAddress(addresses.getEmail1());
contact.save(osBuff, ContactSaveFormat.Msg);
in = new ByteArrayInputStream(osBuff.toByteArray());

MapiMessage message = MapiMessage.fromStream(in);
MailConversionOptions op = new MailConversionOptions();
MailMessage mailMessage = message.toMailMessage(op);
MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();
mhtSaveOptions.setCheckBodyContentEncoding(true);
mhtSaveOptions.setPreserveOriginalBoundaries(true);
int iSaveOptions = MhtFormatOptions.WriteCompleteEmailAddress | MhtFormatOptions.WriteHeader | MhtFormatOptions.HideExtraPrintHeader;
mhtSaveOptions.setMhtFormatOptions(iSaveOptions);
mailMessage.save(os, mhtSaveOptions);

Hi,


Thank you for writing to Aspose Support team.

We were able to observe the issue at our end using the latest version of the API. It has been logged as EMAILJAVA-34230 for further investigation by our Product team. We’ll update you here once there is further information or a fix version available in this regard.