Header Translation for MailMessage save as SaveOptions.DefaultMhtml

Hi,

Dim msg As MailMessage = MailMessage.Load(“D:\sample.eml”)
msg.Save(“d:\test.mht”, SaveOptions.DefaultMhtml)

creates an mht file with header, having the mail header information.

How can I change the language of the header to german?

From -> Von
Sent -> Gesendet

and how can i chage the language of the date?

Wed, 25 Feb 2015 12:01:35 +0100 -> Mitwoch, 25 Feb 2015 12:01:35 +0100

Best regards,
Daniel

@schlumpfger,

Thank you for contacting Aspose support team.

Please give a try to the following sample code and share the feedback.

MailMessage msg = new MailMessage("from@host.com", "to@host.com", "subject", "body");
msg.CC.Add(new MailAddress("cc@host.com"));
try
{
    msg.Date = DateTime.Now;
    MhtSaveOptions mhtSaveOptions = new MhtSaveOptions();
    CultureInfo currentCultureBkp = Thread.CurrentThread.CurrentCulture;
    Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE");
    CultureInfo culture = new CultureInfo("de-DE");
    mhtSaveOptions.FormatTemplates[MhtTemplateName.DateTime] = String.Concat(CultureInfo.CurrentCulture.DateTimeFormat.LongDatePattern, " ", CultureInfo.CurrentCulture.DateTimeFormat.ShortTimePattern);
    mhtSaveOptions.FormatTemplates[MhtTemplateName.From] = @"<span class='headerLineTitle'>Von:</span><span class='headerLineText'>{0}/span><br/>";
    mhtSaveOptions.FormatTemplates[MhtTemplateName.Sent] = @"<span class='headerLineTitle'>Gesendet:</span><span class='headerLineText'>{0}</span><br/>";
    mhtSaveOptions.FormatTemplates[MhtTemplateName.To] = @"<span class='headerLineTitle'>An:</span><span class='headerLineText'>{0}</span><br/>";
    mhtSaveOptions.FormatTemplates[MhtTemplateName.Subject] = @"<span class='headerLineTitle'>Betreff:</span><span class='headerLineText'>{0}</span><br/>";
    msg.Save("output.mhtml", mhtSaveOptions);
}
finally
{
    msg.Dispose();
}