Rename email fields

When rendering email messages, by default the API uses the English language to render field labels such as From, To, Subject etc. There might be the case when you want to change the label of the fields in email message’s header.
GroupDocs.Viewer is flexible enough to allow you to use the custom field labels for email header. The API provides a new property FieldTextMap in EmailOptions class to change the field labels.

Following code sample shows how to use custom field labels.

            using (Viewer viewer = new Viewer("sample.msg"))
                HtmlViewOptions viewOptions = HtmlViewOptions.ForEmbeddedResources(pageFilePathFormat);
                viewOptions.EmailOptions.FieldTextMap[Field.From] = "Sender";
                viewOptions.EmailOptions.FieldTextMap[Field.To] = "Receiver";
                viewOptions.EmailOptions.FieldTextMap[Field.Sent] = "Date";
                viewOptions.EmailOptions.FieldTextMap[Field.Subject] = "Topic";

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to view Word, PDF, Excel, PowerPoint documents with free to use online GroupDocs Viewer App.