Siemens Industry Online Support
Siemens AG
Entry type: Application example Entry ID: 46817803, Entry date: 07/21/2017

Sending Emails to SMTP Servers with an S7 CPU

  • Entry
  • Associated product(s)
SIMATIC S7 stations also allow the use of email as the default mechanism for transmitting error conditions or warnings from industrial plants to a control center or operating staff.

Nowadays, for security reasons, most email service providers only support an encrypted connection to their SMTP servers. The current CPs of the S7-300/S7-400 and S7-1200/S7-1500 can establish a secure connection (SMTP over TLS) to an email server.

The application example shows you how to set up a secure connection (SMTP over TLS) to an email server using the CP of an S7-1500 or S7-1200 station and how to send an email via the standard block "TMAIL_C" from the user program.

Setting up a secure email connection requires the following steps that are described in the application example:

  • Determine and download the provider certificates
  • Allow the email account access by the CP
  • Activate the security features in the CP
  • Import the provider certificates into STEP 7 (TIA Portal)
  • Add the provider certificates to the CP
  • Connect the CP to the Internet
  • Configure the DNS server
  • Parameterize the TMail system data types in STEP 7 (TIA Portal)
  • Parameterize the "TMAIL_C" instruction
  • Set the S7 CPU's time

  Documentation STEP 7 V14 (1,6 MB)

The FBPN_Mail function block (FB490) allows you to establish a non-secure connection from the following modules to an email server:

  • S7-300/400 CPUs

  • ET200S/IM151 distributed I/O systems

  • ET200PRO/IM154-8 CPUs

  • WinAC computers such as SIMATIC Microbox PCs

In the archive, you will find the documentation and sample projects for sending unsecure emails with the "PN_Mail" FB.
registration required Archive (316.5 KB)

Last Changes
Documentation for STEP 7 V14 to establish a secure connection (SMTP over TSL) to an SMTP server with an S7-1500 / S7-1200.

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit