Skip navigation

emNet SMTP Client

The emNet 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.

  • 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.

 Contents

 
[show]
[hide]

SMTP Backgrounds

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

Application layerApplication layer protocol:
SMTP
Transport layerTranport layer protocol:
TCP
Network layerNetwork layer protocol:
IP
Link layerLink layer protocol:
Ethernet (IEEE 802.3), ...

Using SMTP, an emNet 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 emNet 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:

  • PLAIN
  • LOGIN
  • CRAM-MD5
  • NTLM

In the current version, the emNet SMTP client supports only LOGIN authentication.
The following listing shows a typical SMTP session:

S:  220 srv.sample.com ESMTP
C:    HELO
S:  250 srv.sample.com
C:    AUTH LOGIN
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: <1000.2234@sample.com>
C:    From: "User0"
C:    TO: "User1"
C:    CC: "User2" , "User3"
C:    Subject: Testmail
C:    Date: 1 Jan 2008 00:00 +0100
C:
C:    This is a test!
C:
C:    .
S:  250 ok 1231221612 qp 3364
C:    quit
S:  221 srv.sample.com

emNet SMTP Client with TLS Support

Many mail servers on the internet accept only secure connections. The emNet 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 emNet and comes with the sources for using the SMTP client with TLS.

SMTP Relay

The emNet 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.

Requirements

TCP/IP stack

The emNet SMTP client requires a TCP/IP stack. It is optimized for emNet, 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 emNet.

Multi Tasking

The SMTP client needs to run as a separate thread. Therefore, a multi tasking system is required to use the emNet SMTP client.

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

ROM Usage on an ARM7 System

The following resource usage has been measured on an ARM7 system using IAR Embedded Workbench V6.30.6, Thumb mode, no interwork, size optimization.

Add-onROM
emNet SMTP ClientApproximately 7.1 KByte

ROM Usage on a Cortex-M3 System

The following resource usage has been measured on a Cortex-M3 system using IAR Embedded Workbench V6.30.6, size optimization.

Add-onROM
emNet SMTP ClientApproximately 6.5 KByte

RAM Usage

Add-onRAM
emNet SMTP ClientApproximately 4.7 KByte

Relevant parts

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

RFC# Description
[RFC 821]Simple Mail Transfer Protocol
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc821.txt
[RFC 974]Mail routing and the domain system
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc821.txt
[RFC 5321]Simple Mail Transfer Protocol
Direct download: ftp://ftp.rfc-editor.org/in-notes/rfc5321.txt