HtmlFormatOptions header translations

Hey,

when saving an Aspose.Email.MailMessage to Html using Aspose.Email.HtmlSaveOptions and set the HtmlFormatOptions property to Aspose.Email.HtmlFormatOptions.WriteHeader | Aspose.Email.HtmlFormatOptions.DisplayAsOutlook, the header names are in english.

Is there a way to translate these names to another language like a callback or something like that?

Regards

Mark

@msc.bs

Aspose.Email does not provide APIs to translate text of a language to another.

Could please attach the following resources here for testing:

  • Your input document.
  • Your expected output document.
  • Please create a standalone console application (source code without compilation errors) that helps us to reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we will start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Hey,

see attached the used source code (sourceCode.vb) and the html output (htmlContent.html). I marked the affected fields in the attached image (htmlContent.png). We need these fields to be translated ins the respective languages (German, French, etc.), because even on my german system the english values are used for the headers.

Example.zip (7.4 KB)

Regards

Mark

@msc.bs

Unfortunately, Aspose.Email does not support the requested feature. We have logged it as EMAILNET-40515 in our issue tracking system. You will be notified via this forum thread once this feature is available.

We apologize for your inconvenience.

@msc.bs

To translate email headers to another language (e.g. French) please use following code example.

MailMessage msg = new MailMessage("from@host.com", "to@host.com", "subject", "body")
msg.Date = new DateTime(2015, 1, 1, 18, 29, 59);

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.HtmlFormatOptions = HtmlFormatOptions.WriteHeader | HtmlFormatOptions.DisplayAsOutlook;

msg.Save(@"d:\test_en.html", htmlSaveOptions);//english

CultureInfo culture = new CultureInfo("fr-FR");
htmlSaveOptions.FormatTemplates[MhtTemplateName.DateTime] = String.Concat(culture.DateTimeFormat.LongDatePattern, " ", culture.DateTimeFormat.ShortTimePattern);
htmlSaveOptions.FormatTemplates[MhtTemplateName.From] = htmlSaveOptions.FormatTemplates[MhtTemplateName.From].Replace("From:", "De :");
htmlSaveOptions.FormatTemplates[MhtTemplateName.Sent] = htmlSaveOptions.FormatTemplates[MhtTemplateName.Sent].Replace("Sent:", "Envoyé :");
htmlSaveOptions.FormatTemplates[MhtTemplateName.To] = htmlSaveOptions.FormatTemplates[MhtTemplateName.To].Replace("To:", "À :");
htmlSaveOptions.FormatTemplates[MhtTemplateName.Cc] = htmlSaveOptions.FormatTemplates[MhtTemplateName.Cc].Replace("Cc:", "Copie :");
htmlSaveOptions.FormatTemplates[MhtTemplateName.Subject] = htmlSaveOptions.FormatTemplates[MhtTemplateName.Subject].Replace("Subject:", "Objet :");

msg.Save(@"d:\test_fr.html", htmlSaveOptions);//french