Email
SMTP

How to send email with SMTP

How to send transactional email notifications using SMTP with Knock.

Knock supports sending email notifications to your users via the Simple Mail Transfer Protocol (SMTP). In this configuration, Knock will act as an SMTP client and send email notifications to a specified SMTP server.

In this guide, we'll cover how to get started sending email notifications using SMTP with Knock.

Features

  • Attachments support
  • Knock link and open tracking
  • Per environment configuration
  • Sandbox mode

Getting started

You can create a new SMTP Relay channel in the dashboard under the Integrations > Channels section. From there, you'll need to configure the channel for each environment you have.

The following information is required to configure an SMTP Relay channel:

  • SMTP server host
  • SMTP server port
  • Username
  • Password

Please note the following:

  • Knock only supports authenticated SMTP connections.
  • The port must support TLS. Email providers commonly use port 587 for TLS, but check your provider's documentation to confirm.
  • We cannot currently track deliverability through SMTP Relay channels. This means that all notifications sent via SMTP will show up as "Sent" in the Knock messages log, but not "Delivered."

Channel configuration

The following channel settings should be configured per environment. Navigate to Integrations > Channels in your dashboard, select your SMTP channel, then click "Manage configuration" under the environment that you'd like to configure.

Fields marked with an * are required.

Knock settings

Sandbox modeboolean
Whether to enable sandbox mode for your SMTP channel.
Knock open trackingboolean
Whether to enable Knock email-open tracking.
Knock link trackingboolean
Whether to enable Knock link-click tracking.

Provider settings for SMTP Relay

SMTP hoststring*
The SMTP server host.
Usernamestring*
The username to use when authenticating with the SMTP server.
Passwordstring*
The password to use when authenticating with the SMTP server.
Portnumber*
The SMTP server port. This port must support TLS.
From email addressstring | liquid*
The default sender email address (can use Liquid tags).
From namestring | liquid
The default sender name (can use Liquid tags).

When configured, these optional overrides will apply to all emails sent from this channel in the configured environment. Learn more about email channel overrides here.

Tostring | liquid
The To email address that email notifications will be sent to (can use Liquid tags). This value will override the designated recipient's email address.
Ccstring | liquid
The CC email address that email notifications will be sent to (can use Liquid tags).
Bccstring | liquid
The BCC email address that email notifications will be sent to (can use Liquid tags).
Reply-tostring | liquid
The reply-to email address that will be included on email notifications (can use Liquid tags).
Payload overridesJSON (string) | liquid
For SMTP Relay channels, only header overrides are supported. See 'Setting SMTP headers' below for more details.

Set optional per-environment conditions for this channel. These conditions are evaluated each time a workflow run encounters a step that uses this channel in the configured environment. If the conditions are not met, the step will be skipped.

Setting SMTP headers

For SMTP Relay channels, the JSON overrides field can be used to set SMTP headers. Overrides can be set in either the environment settings or per template.

Knock supports overriding existing SMTP headers and adding custom headers.

Headers must be nested under the headers key. Other keys will be ignored.

Recipient data requirements

In order to send an email notification you'll need a valid email property set on your recipient.