Email Relay Configuration Example
The information on this page is updated in accordance with the 00.07.24 firmware version.
Introduction
This guide explains how to configure the Email Relay service on a Teltonika Networks router or gateway. Email Relay allows the device to act as a local SMTP/POP3 mail server, an outbound SMTP proxy that forwards mail through an external smarthost, or a manually started instance configured with extra command line arguments and a dedicated authentication secrets file.
Three configuration examples are covered:
- Mode: Server - the device stores incoming mail locally and allows it to be retrieved via POP3;
- Mode: Proxy - the device accepts outgoing messages from devices on the LAN and immediately forwards ("relays") them to an external mail server - in this example, Gmail's SMTP server - which then delivers the message to its final recipient;
- Mode: Command line - the most flexible way to run Email Relay, since it exposes the full set of emailrelay options - as either a server, a client, or a proxy - with granular control over authentication, TLS, listening interfaces, spool directories, filtering, and more (run
emailrelay --help --verbosecommand on the router for the complete list of available options).
Configuration overview and prerequisites
- The Teltonika Networks device with an Email Relay package installed;
- A device with a terminal application capable of opening raw TCP connections (e.g. telnet), used to test the SMTP/POP3 sessions. In this example a PC with telnet CLI tool;
- A Gmail account with an App Password generated for SMTP authentication;
- SSH/CLI access to the router (required for the Command line example);
Mode: Server
In this mode, the router creates an Email Relay instance that stores incoming messages locally and lets them be retrieved via POP3.
Step 1: Configure the Email Relay instance
![]() |
|
|---|---|
|
Step 2: Send a test message via SMTP
![]() |
|
|---|---|
|
From a LAN PC, open a raw connection to the router on the configured SMTP port and send a test message: telnet 192.168.1.1 587 EHLO EmailRelayTest MAIL FROM:<[email protected]> RCPT TO:<[email protected]> DATA Subject: This is a test message Hello from the LAN PC. . QUIT |
Step 3: Retrieve the stored message via POP3
The LIST command shows the number of stored messages, RETR 1 retrieves the first message, and DELE 1 deletes it from the mailbox. A second LIST confirms the mailbox is now empty.
Mode: Proxy
In this mode, the router does not store any mail itself. Instead, it accepts outgoing messages from devices on the LAN and immediately forwards ("relays") them to an external mail server - in this example, Gmail's SMTP server - which then delivers the message to its final recipient. This is useful when you want LAN devices to send email through a trusted provider's mail infrastructure without configuring each device individually.
Step 1: Configure the Email Relay instance
![]() |
|
|---|---|
|
Note: A Gmail App Password is generated as 16 characters displayed in groups of four, separated by spaces (e.g. abcd efgh ijkl mnop). These spaces are only for readability - remove them when entering the password into the Password field, so it is entered as a single continuous string (e.g. abcdefghijklmnop). For instructions on generating an App Password, see Gmail App Password.
Step 2: Send a test message via the proxy
![]() |
|
|---|---|
|
From a LAN PC, connect to the router on the configured SMTP port and send a test message addressed to an external mailbox: telnet 192.168.1.1 25 EHLO EmailRelayProxyTest MAIL FROM:<[email protected]> RCPT TO:<[email protected]> DATA Subject: The Email Relay Proxy Test Hello, this is outbound relay via gmail smarthost. . QUIT |
Step 3: Verify delivery
The message is relayed through the configured Gmail smarthost and delivered to the mailbox of the recipient specified in RCPT TO. Regardless of what address was entered in MAIL FROM during the test, the received email will always show the sender address configured in Step 1 - in this example, [email protected] - since the smarthost authenticates and sends as that account:

Mode: Command line
Command line mode is the most flexible way to run Email Relay, since it exposes the full set of emailrelay options - as either a server, a client, or a proxy - with granular control over authentication, TLS, listening interfaces, spool directories, filtering, and more (run emailrelay --help --verbose command on the router for the complete list of available options). For simplicity, the example below replicates the Proxy example above using command line arguments instead of the standard Proxy fields, with the authentication credentials stored locally on the router in a separate secrets file.
Step 1: Create the client authentication secrets file
Access the router's CLI and create a secrets file containing the Gmail account address and the generated App password:
mkdir /etc/emailrelay vi /etc/emailrelay/client.auth
Add the following line to the file:
client plain [email protected] abcdefghijklmnop
Step 2: Configure the Email Relay instance
The extra command line arguments used in this example configure the following behaviour:
--forward-to=smtp.gmail.com:587- specifies the address of the remote SMTP server (the smarthost) that received mail is forwarded to;--port=25- sets the local SMTP listening port on which the router accepts outgoing mail from LAN devices;--client-tls- enables negotiated TLS (STARTTLS) when the router connects to the remote SMTP server as a client;--client-auth=/etc/emailrelay/client.auth- enables SMTP authentication with the remote server, using the credentials stored in the specified secrets file.
Click Save & Apply.
Step 3: Verify the process is running
Confirm that the emailrelay process was created and is running:
ps | grep emailrelay

Note: This configuration produces the same result as the "Mode: Proxy" example above. The same functionality can also be achieved by running the following command directly from the CLI:
emailrelay --no-daemon --forward-to=smtp.gmail.com:587 --port=25 --client-tls --client-auth=/etc/emailrelay/client.auth





