image.png (35.2 KB)
Global styles in embedded mail html body affects any html tag in converted email to html. This could effect "Subject, sender … " headers at generated html via Aspose.
Is there any standard way to deal with global styles at email html body with Aspose ? Of course I we could edit body before conversion, but maybe Aspose has already implemented way.
aspose-email-21.6
in_out.zip (12.3 KB)
FileOutputStream out = new FileOutputStream(".\\html2.html");
FileInputStream in = new FileInputStream(".\\17a14f410d08de53.eml");
EmlLoadOptions emlOptions = new EmlLoadOptions();
emlOptions.setPreserveTnefAttachments(false);
emlOptions.setPreserveEmbeddedMessageFormat(false);
emlOptions.setPrefferedTextEncoding(StandardCharsets.UTF_8);
MailMessage message = MailMessage.load(in, emlOptions);
HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.setCheckBodyContentEncoding(true);
int iSaveOptions = HtmlFormatOptions.WriteCompleteBccEmailAddress | HtmlFormatOptions.WriteCompleteCcEmailAddress
| HtmlFormatOptions.WriteCompleteFromEmailAddress | HtmlFormatOptions.WriteCompleteEmailAddress
| HtmlFormatOptions.WriteHeader | HtmlFormatOptions.DisplayAsOutlook;
htmlSaveOptions.setHtmlFormatOptions(iSaveOptions);
message.save(out, htmlSaveOptions);