Templates and message streams: write your message once
A template holds the layout; per send you only pass the values to fill in, such as the name and the order number. A template is never required: you can also pass the complete content per message, over SMTP or the Send API. With a message stream you say what kind of email it is: a newsletter, or something the recipient asked for such as an invoice. If someone unsubscribes from your newsletter, they still get their invoices.
Three things you set up once
Three things you set up once and can then leave alone.
-
Layout out of your code
The order confirmation lives in the panel, not in the code of your website. So changing a comma no longer means asking your developer to deploy.
-
Values per recipient
Name, order number, amount: you only pass those values. Sending to several addresses? Then you give each address its own values.
-
Keep your email apart
An order confirmation and a newsletter are different kinds of email. With a message stream, an unsubscribe stops exactly the email that unsubscribe was about.
How a template works
You create it under Templates in the panel. You fill in four fields; the name is for you alone, because your recipient never sees it.
| Field | What goes in it |
|---|---|
| Name | how you recognise this template |
| Subject | the subject line of the message |
| HTML version | the formatted content |
| Text version | optional; leave it empty and we derive a readable text part from your HTML |
- Name
- how you recognise this template
- Subject
- the subject line of the message
- HTML version
- the formatted content
- Text version
- optional; leave it empty and we derive a readable text part from your HTML
Do not leave the text version empty without thinking
Some mail clients show only the text part. And a message made of HTML alone gets a stricter look from spam filters. We derive a text part automatically, but writing it yourself reads better.
Values to fill in: double braces, nothing more
Wherever a value belongs, you write the name between double braces. When you send, you pass those same names along.
The template text
Subject: your order {{ordernumber}} is on its way
Hi {{firstname}},
Your order {{ordernumber}} shipped today.
You will hear from us the moment the courier has it.
Below the edit screen sits the Variables card with everything we found in your texts. Those are exactly the values you have to send with every request.
The request
POST /v1/messages
{
"from": { "email": "noreply@yourdomain.com" },
"to": [ { "email": "recipient@example.com" } ],
"template_id": 7,
"variables": { "firstname": "Jan", "ordernumber": "A-1024" },
"stream": "transactional"
}
You pass the template number instead of your own content. Forget a value and we send nobody anything: you get the missing names back. That is better than a message that reads "Hi ,".
Any sender address on a verified domain name can be used to send email
Read how templates work in the knowledge base
And this comes out
The same template text above, with the values from the request filled in. The filled-in spots are highlighted; in the real message there is nothing to see there.
The template text
- From
- noreply@yourdomain.com
- To
- recipient@example.com
- Subject
- your order A-1024 is on its way
Hi Jan,
Your order A-1024 shipped today.
You will hear from us the moment the courier has it.
Made-up example, not a real message and not customer data.
Three rules worth knowing
-
There is no logic in it
No "if this, then that", no loops, no filters. That logic belongs in your own code; you only send the outcome.
-
A value cannot break your layout
In the HTML part a value goes in as text. Pass <b>Jan</b> and that is literally what appears. In the subject and the text version the value arrives exactly as you sent it.
-
Every save keeps the previous text
At the bottom of the edit screen sits the version history: view and restore. Restoring puts the old text back as a new version, so nothing is ever lost.
Test it before a customer sees it
Fill in a sample value per variable and the edit screen builds the message with them. Send test message sends that same sample to your own address, including changes you have not saved yet.
How many templates you get
Free and Skiff give you two. From Clipper they are unlimited. At the limit, the create form says so; existing templates keep working and you can keep editing them.
Message streams: two kinds of email
Someone gets an order confirmation because of something they did themselves. A newsletter you send on your own initiative. We know no other kinds.
| Stream | What it is |
|---|---|
| Transactional | email the recipient asked for or triggered themselves: a password reset, an invoice, a confirmation |
| Newsletter | email to a list people can unsubscribe from: a newsletter, an announcement |
- Transactional
- email the recipient asked for or triggered themselves: a password reset, an invoice, a confirmation
- Newsletter
- email to a list people can unsubscribe from: a newsletter, an announcement
How the stream of a message is decided
There are three ways; the first one that is filled in applies.
-
In the request itself
Through the Send API you set the field stream to transactional or broadcast.
-
With an extra line in the email
Sending over SMTP, you put the header X-SP-Stream on your message. That is an extra line at the top of the email, separate from the content. We strip that line before sending, so your recipient never sees it.
-
The default of your credentials
On the Settings tab of your domain you pick, per SMTP login, what applies when the message itself says nothing.
If nothing is filled in, it is transactional
That is the safe choice: an unsubscribe for the newsletter does not block transactional email. The most common setup is two SMTP logins with a default each. Your shop on transactional, your newsletter software on newsletter. Then you have nothing to fill in per message.
What a message stream is not
It is not separate sending infrastructure. There is one route and one reputation. So labelling your newsletter as a newsletter does not shield your order confirmations from a bad reputation. For that you use a separate (sub)domain.
An unsubscribe stops only that kind of email
That is what the message stream exists for: it decides which email a block on an address holds back. There are three rules.
- A hard bounce counts for all your email. The mailbox does not exist; then it exists for no stream.
- An unsubscribe or complaint counts only for the stream that email was in, if that stream is known.
- If the stream is not known, the block counts for all your email.
Unsubscribing is yours to arrange
We put no unsubscribe link in your email and host no unsubscribe page. What your readers see, and where they end up, you decide yourself. What you can send along are two technical lines in your email: List-Unsubscribe and List-Unsubscribe-Post. Gmail and Outlook then show their own 'Unsubscribe' button at the top. We check that those lines are valid before we send your message.
Limits and things to watch
What you want to know before you set it up.
- Two templates without a paid plan
- On Free and Skiff you may have two, on Clipper and Fleet unlimited. Templates belong to your account and not to one domain. With three domain names you still write your invoice email once.
- Your own content beside a template is refused
- Pass a template number and the HTML and text come from it. Passing your own subject is allowed; that one wins over the subject in the template.
- A misspelled stream name over SMTP gives no error
- Through the Send API you get an error back. Over SMTP we cannot report anything back to your program. We ignore the unusable line and use the default of your SMTP login.
- One blocked address, and the whole message is refused
- If one of the recipients is on the suppression list for this stream, we refuse the whole message. So send newsletters one recipient at a time; then you also see per recipient what happened.
- Only the owner and admins change them
- Everyone in the account may look. Creating, editing, duplicating and deleting are for the owner and the administrators.
- A deleted template is really gone
- Check first that your code no longer uses that template number anywhere. Requests with that number get an error afterwards and nothing is sent.
Write your first template
Create an account, verify your domain name and write your order confirmation once. The free plan has no end date.