ForNAV Email Body Layouts

You can use ForNAV reports to generate email body text. However, you might not always get what you expect. In this article, we will look at some of the challenges and try to explain the underlying reason for the occasional strange or unpredictable behavior.

Business Central requires the email body to be HTML formatted text. HTML is a well-known standard used on the Internet for formatting content such as text and images. Those of us who have worked with HTML in the past know that it can be interpreted in different ways by various browsers, so even though it is a standard, it produces different results depending on who is rendering it. This is one of the fundamental problems in generating the email body text.

When using a report to create the HTML, we are changing the fundamental structure of something that was built to place your text and images at exact coordinates with an exact size. It is changed to something designed for a flow-based layout engine where page width, size, and resolution can change.

Another problem is that the Business Central email editor is basically an HTML editor written in HTML and JavaScript. This puts limitations on which HTML codes you are allowed to use. Some HTML tags and styles could potentially break the editor and the Business Central client rendering. Therefore, the editor processes the email body before it presents it in the editor, to avoid the most obvious side effects. This is the first place where the original email body HTML can be corrupted.

Our reporting engine could produce HTML using exact positioning, but this is not supported by the Business Central email editor. Therefore, we have to switch to table-based layouts, which are somewhat similar to Excel tables but with less predictability and accuracy.

When you have finished editing an email body, the editor tries to make an HTML representation of your edited text. Additional alteration of your original HTML can take place during this step.

You email is now handed over to an email client such as SMTP or Outlook. Some clients might do additional formatting before the mail is sent.

On the receiving side, you have a variety of email clients. All modern email clients understand HTML body text but each of them has their own implementation of how to render the HTML. Outlook clients are built on the foundation of RTF, which is another language for representing formatted content. Therefore, your email body is first converted to something that can be shown as RTF before it is displayed to the user.

It should be clear by now that a lot of your neatly designed body content can be lost in translation before it reaches the receiving user. Therefore, we recommend that you play around with formatting your body content until you hit upon something that looks acceptable in the editor and the common email clients.

Have fun 🙂