- Print
- PDF
How Do I Create HTML Emails in Lasernet?
HTML can be used to create more complex and visual emails. The HTML body is controlled by the JobInfo called MailBodyHTML.
The following Form configurations will require a basic setup of Input, Mail Output, and Form Engine modules.
Use Dataset and XHTML
When you create a Form, you can choose XHTML for RichText Output, which enhances the mail merge process.
How Do I populate the JobInfo MailBodyHTML on the Mail Output?
To populate the JobInfo MailBodyHTML on the Mail Output, follow these steps:
From Lasernet Developer, open the Mail Output module to edit the settings for the module.
Navigate to the JobInfos tab and click Add.
This allows us to call and manipulate the JobInfos that the module will use.
In the pop-up window, select MailBodyHTML as the JobInfo Name.
Insert the HTML code as the JobInfo value and confirm changes by clicking OK. In this example, the following is being used:

Once a job has been processed in the Mail Output module, the email sent to recipients will display the HTML-generated page. Further HTML elements can be used to show images, tables, URLs, etc.
Can I Use Dynamic Data in the HTML?
Dynamic data can be inserted into the mail body either via a script or JobInfo substitution. In the example below, a JobInfo that has already been created within a Form is being picked up, and a JobInfo substitution is used to insert it into the mail body.
The declaration to use HTML in the mail body has been made and a paragraph containing the words “Good Morning #CustomerName#,” has been set.
The Customername JobInfo is used to dynamically add the customer's name to the email body. The JobInfo referenced in the HTML body must exist and contain a value before getting to the Email Output as mentioned.
For Lasernet to be able to reference the dynamic data, you need to enclose the JobInfo name with hashtags: #Customername#. This will retrieve the value of this JobInfo and apply it to the email; if the JobInfo is an array it will retrieve the first value in the array.

How Do I Set This Up with Sheet Embedding? [ Lasernet 8+ only]
Version 8 introduced multiple advanced output formats, including XHTML, so you can define the HTML body of our outgoing email in Form Editor. This allows you to edit and populate the HTML to put into the MailBodyHTML JobInfo. Sheet embedding means the contents of the sheet are stored in a specified JobInfo to be available for the next sheet.
Create the Form
Navigate to your Form Engine and Add a new Form.
Give your Form a Name and optionally a Description.
Select the Input Format as Dataset from the drop-down list.
Select the Output Format as XHTML.

Click OK.
Prepare the Form in the Form Editor
Open the Form and select a Grab file.
Add a Form criterion.
Create or open the XHTML Template on the right. The Template view is for creating the output/structure of the XHTML page using the built-in tools to create Tables, Headers, Shapes, etc. These objects can be easily formatted.

It is possible to import an already existing template. Use the Open Template button and select the XHTML file you would like to use.
Set Up a Rearrange
Switch back to the XHTML view on the right to see the structure of the document.
Choose the Rearrange tool and select the data you would like to pick up.
Double-click or right-click Properties to edit the Rearrange settings.
On the output settings for the Rearrange, assign this Rearrange to the output below the header (this can be different in your XHTML Template) and confirm changes by clicking OK.
The example below shows the Rearrange being added to a table.

Check your output by clicking on the Preview button on the upper left-hand side. You should see your Rearrange added to the output.
Set Up Sheet Embedding
Create a second Sheet by right-clicking on the Sheet tab (or Form > Define Sheets in the top menu) and selecting Add. This sheet will be your document to be attached to the email.

Set the Destination on the new Sheet to your Mail Output module.

Switch back to the first Sheet and open Sheet Options: right-click on the Sheet tab ( or Sheet > Sheet Options in the top menu).
Navigate to Combining and enable JobInfo: MailBodyHTML. The content of the sheet is stored in the selected JobInfo and available for the next sheet(s); the settings for destinations are ignored, and no output job is created.

Set a Filename on the Attachment
Open the second sheet options and click Post JobInfos.
Add a Filename JobInfo with a value including the extension.
Set a mail subject
Open the second sheet options and click Post JobInfos.
Add a MailSubject JobInfo with a value of the email subject.