Templates serve as the foundation of a mail and can be customized as much as you wish, even including variable data such as names or email addresses just to name a couple.

To create a template, use the navigation bar along the side and click on the 'Templates' heading under 'Resources'.

1905

If you have previously created templates, you can find them right here. You can use the search functionality to find templates with certain descriptions, specific IDs, or were created at a specific date. Don't be too intimidated with knowing the template ID if you don't plan on using the API, while those that will should remember that they can always find the template ID they need by heading to this page. This page is also useful if you wish to comeback and fix or delete a template, which can be done by simply finding and selecting the template you wish to modify.

Over the next few sections we will go over how to create templates

  • Directly with HTML
  • Using our built-in editor
  • Uploading a PDF

Directly using HTML

To create a new template, simply navigate to the 'Create Template' button found in the top right.

1907

Immediately, we are greeted with the HTML creator. In here, you can insert whichever HTML content you would like to send as long as it is contained in a single HTML file. This would require that any styling must either be done inline as

<div style="color:red">

or by including style tags within the <head> such as

<head>
	<style>
		.narrow: {
			width: 19px
		}
	</style>
</head>

Keep in mind that this will be converted to print, so use the print preview feature of your browser for an idea as to how it will turn out. PDF previews of actual letters can be found after creation of the letter. There are some other specifications to abide by, and these will be covered in a later section titled 'Formatting Concerns'.

Navigating the Template Editor

If you don't have an HTML file available, PostGrid comes with a built-in template editor so you can easily design templates. For an in-depth guide of how to use the editor, read this guide.

Adding Variables to Templates

One of the most useful features of templates is the ability to add variable information. To add variable data to a template, simply add a text element and write {{variable_name}}, where variable_name can be whatever you wish. There are also some preset variables which fill-in based on sender and receiver information such as {{from.firstName}}.

1593

Variables may also be added through the HTML editor by including same format within the HTML itself. Variables may also be used to control styling of HTML elements in this way, such as setting

<p style="color:{{section_color}}">

Actually filling in the data is simple enough and we will show you how to do it in the 'Creating and Sending Letters' section. During the template creation phase, you only need to worry about adding in which data may vary from letter to letter as you use the template while PostGrid helps you to take care of the rest.

To know which variables can be filled in from contact information, take a look at the details of a contact to see what information is available. Opening up the 'Raw Data', here is an example below.

1768

Variables with nested information can be accessed using variable.nestedInfo, such as specifying {{income.afterTax}} to access the income after tax which may be stored as

{
	"income" : {
		"beforeTax" : "100000",
		"afterTax" : "73000"
	}
}

More information on variables can be found below.

Using PDFs

If you don't need to create a template but instead have PDFs already ready to send to specific contacts, then you can move right along to the sending part.