Line breaks in email notifications and rich HTML

Rich HTML provides additional control over line breaks in your email notifications and templates.

To accommodate this, a Newlines to HTML check box is available in the Email Script form.
Figure 1. The Newlines to HTML option

Selecting the Newlines to HTML check box indicates that the method for handling line breaks in earlier versions carries forward for email notifications and templates. When an email notification or template is converted to rich HTML, the Newlines to HTML check box is automatically selected.

For new mail scripts, it is a best practice to add correct HTML line breaks to template.print() statements.

If an email notification or template to rich HTML is not converted to rich HTML, newlines are automatically wrapped with <div> tags, the same as previous versions. The old mail scripts still work; however, the administrator does not enjoy the benefits of working in the rich HTML format, and does not have as much control over exact HTML formatting.

Best Practice

When writing new scripts, it is best to insert explicit HTML line breaks and clear the Newlines to HTML check box so that no HTML tags are injected when email notifications are generated. The same approach is recommended for existing notifications and templates. That is, a best practice would be to replace template.print("\n") JavaScript function calls with template.print("<br />"). This gives you better control over the HTML formatting of your email notifications.