Entry type: FAQ, Entry ID: 24139712, Entry date: 07/10/2009

How can you use a PC to simulate or realize sending e-mails in the case of an HMI station message?

  • Entry
  • Associated product(s)

With WinCC flexible, the triggering of bit or analog messages can cause e-mails to be sent to the operators. You can use any SMTP server (e-mail output server) for sending e-mails, which doesn't need any authentication. As from WinCC flexible 2005, also SMTP servers that require authentication via a valid e-mail address are supported. SMTP servers that require authentication with user name and password can be used as from WinCC flexible 2008 SP1.


  1. Information on SMTP servers
  2. Requirements
  3. Configuration
    3.1 Configuration of the SMTP server
    3.2 Configuration of WinCC flexible
    3.3 Verification of the configuration
  4. Download

1. Information on SMTP servers
In addition to the many SMTP servers in the Internet, you can also integrate your own SMTP server in the local network. In this example we use the "PostCast Server" that is available for downloading at the Internet address http://www.postcastserver.com/download/.

Fig. 01

Alternatively you can also install the SMTP server on a separate computer and use it with a Multi Panel via Ethernet, for example. Communication between the panel or a second PC and the SMTP server is exclusively via Ethernet. 

Fig. 02

Communication between S7 controller and panel must not necessarily be via Ethernet as shown in Fig. 02.

There must be a connection to the SMTP server before you can send e-mails.
Designation Protocol Server
SMTP Simple Mail Transfer Protocol E-mail output server
IMAP Internet Mail Access Protocol E-mail input server
POP3 Post Office Protocol Version 3
Table 01

2. Requirements

  • From STEP 7 V5.3 onwards
  • As from WinCC flexible 2005 SP1 (Advanced Edition for PC Runtime)
  • SMTP server

3. Configuration
How to send e-mails via a local SMTP server is demonstrated in a STEP 7 project available for downloading.

3.1 Configuration of the SMTP server
In the following we will primarily explain the combined version (Fig. 01). There are however also notes on the separated version (Fig. 02) between SMTP server and the WinCC flexible Runtime via Ethernet.

The table below shows the settings for the SMTP server "PostCast Server".

No. Procedure

Downloading the SMTP server
Download the SMTP server from the Internet address http://www.postcastserver.com/download/.

You can also use any other SMTP server that doesn't need any authentication. SMTP servers with authentication depend on the version of WinCC flexible used.


Unpack and install software

  • Unpack the downloaded file "postcastserver.zip" on the computer on which the SMTP server is to be installed.
  • Then install the SMTP server (PostCast server) by double-clicking on "Setup.exe".
3 Set up the SMTP server
  • Click on "Settings" in the toolbar to open the SMTP settings.
  • As host name you enter the IP address (local host) and the server port 25 (SMTP).

    In the case of separated systems you must specify the name or IP address of the computer on which the SMTP server is installed.
  • If you are using a DNS server, you must also specify the relevant IP address and port 53.

Fig. 03

Make sure that the port is not already assigned or blocked by a firewall.
Since the port numbers are defined by the IANA (Internet Assigned Numbers Authority), you should use only the two ports for the two services.


Service Description
25 SMTP Sending of e-mails
53 DNS Resolving of domain names in IP addresses
Table 02

Define conditions for sending e-mails
Under "Mail sending frequency" you can define when e-mails are to be sent. If you select the "Manually" option, all e-mails are sent only when you press the "Start" button. If you select "Immediately", the e-mails are sent at once after a pause after each process, which you can specify.

Fig. 04

For simulation you should always select "Manually", because e-mails are not sent automatically and you can do without connection to an e-mail input server.
5 Define connections
Limit the number of outgoing connections to a maximum of 20.

Fig. 05
6 Define other settings
The following settings in the "Administration" tab should be set by default. But you should nevertheless check the following points and act where applicable:
  • Under "E-mail message is undeliverable after:" you specify the days, hours or attempts to be made before an e-mail is declared as undeliverable and deleted.
  • Check "Force message delivery..." to permit message delivery to multiple hosts.
  • Optionally you can create another log file and define the maximum size of that file after which a new log file is to be created.

Fig. 06
7 Advanced settings
The settings in the "Advanced" should also be set by default. In any case you should always verify and if necessary, make the following settings:
  • Check the "Show system tray icon" option to have the icon of the PostCast server displayed in the taskbar.
  • Check "Detect changed IP addresses and configure the program" so that any changes to IP addresses are recognized automatically and the SMTP server configured accordingly.
  • As an option you can also check "Automatically check for updates".

Fig. 07

3.2 Configuration of WinCC flexible
The following table explains the major settings in WinCC flexible for sending e-mails.

The sending of e-mails is demonstrated taking the example of a fan, which is available for downloading at the end of this entry. The fan is simulated by the STEP 7 program and must be transferred to an S7 controller or S7-PLCSIM for the simulation.

If you use the sample project and you know the configuration for sending e-mails in WinCC flexible, then you can go directly to the next table.

No. Procedure
1 Create a WinCC flexible project
Create a new WinCC flexible project and select the PC Runtime.

For the separated version you can also select an operator panel - except Basic Panels - that has an Ethernet interface.

2 Configure the connection
It is of no importance whatsoever which connection you choose for sending e-mails. You must simply ensure that there is a physical connection between the SMTP server and the operator panel.

For the separated version you only have to set up a physical connection with a patch cable - you don't have to configure this connection. Communication between operator panel and SMTP server is performed exclusively via Ethernet.

Fig. 08
  • Open the "Connections" tab by double-clicking on "Connections" in the project tree under "Project > Communication".
  • Create the connection(s) you need for communication to the PLC. The PROFIBUS connection is used in this example.

You do not need to create a connection for communication between WinCC flexible Runtime and SMTP server.

3 Configure the SMTP server
The name of the SMTP server must be made known for WinCC flexible Runtime to be able to communicate with an SMTP server.
  • For this you open the "Device Settings" tab.
  • Here you enter "localhost" for "Name SMTP server".


    If the SMTP server is running on a different computer, then you specify the computer name or the IP address of the SMTP server. For panels with Windows CE, only the computer name or the FQDN (Fully Qualified Domain Name) is permissible.
  • The "Name of SMTP sender" input field serves as an answer e-mail address. Here you can enter the designation of the HMI operator panel or plant designation or its location.

Fig. 09

No SMTP authentication is needed for the "PostCast server". If you are using a different SMTP server that requires authentication via a valid e-mail address (as from WinCC flexible 2005), then you must enter this in the "SMTP Authentication" input field.

SMTP authentication with user name and password is supported only as from WinCC flexible 2008 SP1.

4 Create analog and bit alarms
In order to have e-mails sent when an alarm is triggered, you must create analog and/or bit alarms.
  • Open the "Analog Alarms" tab by double-clicking on "Analog Alarms" under "Alarm Management" in the project tree.
  • For example, add the analog alarms "rotation high" and "maximum speed of <tag User.SRPM_0> achieved".
  • Select "Warning" as the alarm class and "User.S_RPM_0" as trigger tag and "On rising edge" as trigger mode.
  • As limit value for the "rotation high" analog alarm you select the value "1199", for example, and the limit "1349" for the second analog alarm.

Fig. 10

Optionally you can also create bit alarms in addition. For this you proceed as follows.

  • Open the "Discrete Alarms" tab.
  • For demonstration purposes you can create the bit alarm "overspeed trip unit at <tag DB User.M_RPM>".
  • Also select "Warning" as the alarm class. In the sample project we use the trigger tag "SOLL_IST" (setpoint_actual) with trigger bit number "10".

Fig. 11
5 Specify the e-mail address in the alarm class
Open the "Alarm Classes" tab and enter the relevant e-mail address. In this example we use the fictitious e-mail address "admin@firma.de".

Fig. 12

With this configuration, an e-mail is sent for every incoming alarm of the alarm class. If you want to have an e-mail sent only for specific alarms, then you have two options:

  • Create a new alarm class and assign the relevant alarms to that alarm class (see Figs. 10 to 12).
  • Add the "SendEMail" system function in the Properties dialog under the "Activate" event of the alarm concerned in each case.

You can specify any valid e-mail address as recipient e-mail address (see Fig. 12) and it doesn't necessarily have to be an e-mail address of the same provider as the SMTP server.

3.3  Verification of the configuration
The S7 program that includes a simulation of a fan for WinCC flexible helps to illustrate the sending of e-mails to the SMTP server.

No. Procedure
1 Transfer the STEP 7 project
  • If you using the sample project, transfer the configuration and the STEP 7 project into the controller or into the S7-PLCSIM simulation program.
  • Switch the S7 controller to RUN mode.

Fig. 13
2 Start PostCast Server
You must first start "PostCast Server" for it to be able to receive e-mails from WinCC flexible.

Start the PostCast Server in Windows via "Start > Programs > PostCast Server" and clicking on "PostCast Server", or by clicking on the desktop icon.

Fig. 14
3 Start WinCC flexible Runtime
  • Start the WinCC flexible Runtime via the menu entry "Project > Generator > Start Runtime".

    When using the second version, you transfer your configuration to the operator panel concerned. For the first transfer you should also transfer the password list as well.
  • Enter a Set rotation speed of at least 1350 rpm-1.
  • Enter at least 5 seconds for Run-up/-down time.
  • Click the "Start" button.
  • Wait until the set rotation speed is reached.

Fig. 15
4 E-mails in the SMTP server
Once the motor has been started and the maximum speed reached, e-mails are sent to the SMTP server according to the alarms configured.

Fig. 16

If the SMTP server has a connection to the Internet or to the relevant e-mail input servers (POP3 or IMAP), you can send e-mails via the "Start" button. The requirement for this is that you use a real recipient e-mail address.

More information is available in the following entries.

Topic Entry
Sending of e-mails Entry ID: 18984102
Sending of text messages (SMS) Entry ID: 21184132

4. Download
Attachment 1 contains the sample project described including the STEP 7 program with the motor simulation for WinCC flexible. The SMTP server is not include and cannot be procured from SIEMENS AG.

Attachment 1: WinCC_flex_SMTP.zip ( 3548 KB )

Runnability and test environment:
The following table lists the components that have been used to create this entry and verify the functions described.

Components Product and version designation
PC operating system Microsoft Windows XP SP2
Standard tools PostCast Server V2.6.0
Engineering tool STEP 7 V5.3 SP3
HMI software WinCC flexible 2005 SP1
HMI system MP370

SendEmail, Error message, E-mail, Sending e-mails