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

Free Support Forum - aspose.com

Time zone is not set properly while converting EML to MHT

Hi Team,
I am using aspose email java 21.5 but not able to set timezone property while converting EML to MHT
Please suggest me some sample code.

Thanks
Swapnil

@ssherekar,
Thank you for the query. You can set the timezone for an email message and then convert the message to MHT file as shown below:

MailMessage mailMessage = MailMessage.load(dataPath + "test.eml");
mailMessage.setTimeZoneOffset(5 * 60 * 60 * 1000); // 5 hours

MhtSaveOptions mhtOptions = new MhtSaveOptions();
mhtOptions.setMhtFormatOptions(MhtFormatOptions.WriteHeader);
mailMessage.save(dataPath + "test.mhtml", mhtOptions);

More examples: Loading and Saving Message
API Reference: MailMessage Class