emWin upgrade     Trade-In program     Web shop

embOS/IP SMTP Client

The embOS/IP SMTP client is an optional extension which can be seamlessly integrated into your TCP/IP application. It combines a maximum of performance with a small memory footprint. The SMTP client allows an embedded system to send emails with dynamically generated content. The RAM usage of the SMTP client module has been kept to a minimum by smart buffer handling.

The SMTP client implements the relevant parts of the following Request For Comments (RFC).

RFC# Description
[RFC 821] Simple Mail Transfer Protocol
Direct download:
[RFC 974] Mail routing and the domain system
Direct download:
[RFC 5321] Simple Mail Transfer Protocol
Direct download:

The following table shows the contents of the embOS/IP SMTP client root directory:

Directory Content
Application Contains the example application to run the SMTP client with embOS/IP.
Config Contains the SMTP client configuration file. Refer to Configuration on page 225 for detailed information.
Inc Contains the required include files.
IP Contains the SMTP client sources, IP_SMTPC.c and IP_SMTPC.h.
WindowsSMTPC Contains the source, the project files and an executable to run embOS/IP SMTP cli- ent on a Microsoft Windows host.

Supplied directory structure of embOS/IPSMTP client package

Feature list

  • Low memory footprint.
  • Independent of the TCP/IP stack: any stack with sockets can be used.
  • Example applications included.
  • Project for executable on PC for Microsoft Visual Studio included.
  • Send emails securely via TLS with emSSL. This allows using almost any mail server on the internet.1

1 emSSL delivers the secure connection and has to be purchased separately.


TCP/IP stack
The embOS/IP SMTP client requires a TCP/IP stack. It is optimized for embOS/IP, but any RFC compliant TCP/IP stack can be used. The shipment includes a Win32 simulation, which uses the standard Winsock API and an implementation which uses the socket API of embOS/IP.
Multi tasking
The SMTP client needs to run as a separate thread. Therefore, a multi tasking system is required to use the embOS/IP SMTP client.

SMTP Relay

The embOS/IP SMTP Client may also be used in combination with an SMTP Relay Client. A document descibing the configuration of an exemplary SMTP Relay Client application, the Mercury Mail Transport System, is available at our download page.

embOS/IP SMTP client with TLS support

Many mail servers on the internet accept only secure connections.
The embOS/IP SMTP client can be extended with emSSL to create a secure connection using TLS.
This allows using almost any mail server on the internet.
emSSL has to be purchased in addition to embOS/IP and comes with the sources for using the SMTP client with TLS.

SMTP backgrounds

The Simple Mail Transfer Protocol is a text based communication protocol for electronic mail transmission across IP networks.

Using SMTP, an embOS/IP application can transfer mail to an SMTP server on the same network or to SMTP servers in other networks via a relay or gateway server accessible to both networks. When the embOS/IP SMTP client has a message to transmit, it establishes a TCP connection to an SMTP server and transmits the message content after the handshaking.

The handshaking mechanism normally includes an authentication process. The RFC define the following four different authentication schemes:

  • CRAM-MD5
  • NTLM

In the current version, the embOS/IP SMTP client supports only LOGIN authentication.

The following listing shows a typical SMTP session:

S:  220 ESMTP
C:    HELO
S:  250
S:  334 VXNlcm5hbWU6
C:    c3BzZXk29IulbkY29tZcZXIbtZ
S:  334 UGFzc3dvcmQ6
C:    UlblhFz7ZlblsZlZQ==
S:  235 go ahead
C:    Mail from:
S:  250 ok
C:    Rcpt to:
S:  250 ok
C:    Rcpt to:
S:  250 ok
C:    Rcpt to:
S:  250 ok
C:    DATA
S:  354 go ahead
C:    Message-ID: <>
C:    From: "User0" 
C:    TO: "User1" 
C:    CC: "User2" , "User3" 
C:    Subject: Testmail
C:    Date: 1 Jan 2008 00:00 +0100
C:    This is a test!
C:    .
S:  250 ok 1231221612 qp 3364
C:    quit
S:  221

Resource usage

The ROM usage depends on the compiler options, the compiler version and the used CPU. The memory requirements of the SMTP Client module presented in the tables below have been measured on an ARM7 and a Cortex-M3 system. Details about the further configuration can be found in the sections of the specific example.

Configuration used

#define SMTPC_OUT_BUFFER_SIZE        256
#define SMTPC_IN_BUFFER_SIZE         256

Resource usage on a Cortex-M4 system

The following resource usage has been measured on a Cortex-M4 system using SEGGER Embedded Studio V3.10e, usin size optimization.

ROM usage

Add-on ROM
embOS/IP SMTP Client Approximately 2.7 kBytes

RAM usage

Add-on RAM
embOS/IP SMTP Client buffers w/o task stack Approximately 600 bytes

The RAM requirement for the work buffers on the task stack is approximately 600 bytes for the mentioned configuration. Only the bigger buffer size of SMTPC_AUTH_USER_BUFFER_SIZE or SMTPC_AUTH_PASS_BUFFER_SIZE is used for a single buffer.