IMDTouchKnowledge BaseShop main store

How-to

Sending email from WinCC Runtime in TIA Portal

HMI and touchscreens Published 7 min read By IMDTouch engineering team

Short answer

Email leaves a WinCC runtime only when four links hold: the runtime type has a mail mechanism, the station reaches the SMTP server on the required port, encryption and authentication match the server, and an edge-triggered event fires the send. Prove all four from the runtime station, TCP test first, then a client send, and copy the proven values into the project. WinCC Unified stores its SMTP servers in the global email settings with 25 as the documented default port.

On this page
  1. Where the send breaks
  2. Ports and encryption pair up
  3. Collect these values before touching the project
  4. Prove the path, then configure the runtime
  5. Where the SMTP data lives in the runtime
  6. Counting sends for a level condition true for 30 seconds
  7. Pitfalls that survive a correct configuration
  8. Questions asked

Email leaves a WinCC runtime in TIA Portal only when four links hold: the runtime type has a mail mechanism at all, the runtime station opens a TCP session to the SMTP server on the required port, encryption and authentication match what that server demands, and an edge-triggered event fires the send. The configuration screens rarely show which of the four is broken, so prove each link outside the HMI first and then copy the proven values into the project. Work the steps below in order; most failed sends die at the network test, not in the project.

Where the send breaks #

Classify the failure by where it stops before changing any setting. A send that dies with a connection error at the socket has its own diagnosis path in the why a WinCC flexible email fails with a connection error article; the table sorts the rest.

What you observe Link that broke Check that decides it
No send attempt, no traffic leaves the station Trigger logic or runtime capability Confirm the trigger fires and the runtime type documents a mail function
Connection attempt never completes Routing, DNS or firewall TCP test from the runtime station, expect TcpTestSucceeded : True
Connection opens, then the session closes at once Wrong port or encryption pair Compare the configured port and mode with the relay's requirement
Server answers but rejects the message Authentication or sender policy Read the 5xx reply text in the relay log, which names the cause
Message accepted but never delivered Spam filtering or wrong recipient Check the relay queue and the recipient's junk folder

Ports and encryption pair up #

Email from an HMI is an ordinary SMTP client session: the runtime resolves a hostname, opens a TCP connection, optionally upgrades to TLS, authenticates and submits sender, recipient and body. The server has no concept of an HMI, so every step must succeed with values it accepts.

The port and the encryption mode are a pair, not two free choices. Port 25 carries plain relay between mail servers that already trust each other. RFC 8314, the best-practice document for mail submission, assigns port 587 to submission that starts in the clear and upgrades with STARTTLS, and port 465 to submission encrypted with TLS from the first byte. A client set to STARTTLS and aimed at an implicit-TLS port fails during the handshake, which looks like a dropped connection rather than a rejection. A session that gets through negotiation and then resets points to a TLS version or cipher mismatch, which the TLS v1.3 handshake reset fix walks through.

Collect these values before touching the project #

Get these from whoever runs the mail server, in one conversation:

  • The runtime type, the TIA Portal version and the operating system of the runtime station, because the mail mechanism differs by product.
  • The relay's hostname rather than a bare IP address, so DNS stays inside the test.
  • The port and encryption pair the relay requires, from the three pairs above.
  • Whether login is required and with which credential; many corporate and cloud mail services refuse a plain username and password from a custom client, so ask for an approved relay or an application credential.
  • The sender address the relay will accept; many relays reject a sender outside their own domain.
  • The firewall path from the HMI network segment to the relay, including any plant-to-office boundary rule.

Prove the path, then configure the runtime #

  1. Resolve the relay's hostname from the runtime station. If resolution fails, fix DNS or the gateway on the office-facing adapter before anything else; one temporary test against the IP address separates a DNS fault from a routing fault.
  2. Test the TCP path from that same station: Test-NetConnection -ComputerName smtp.plant-mail.local -Port 587, where the example hostname stands for your relay's name. Expect TcpTestSucceeded : True. A False result is a firewall, routing or wrong-port problem that no setting inside the project repairs. If the runtime is a panel rather than a PC, run the same test on the PC on the panel's network path or read the answer from the firewall between them.
  3. Send one message from a known-good mail client on the same PC, using the identical host, port, encryption pair, sender and credential. If the client fails, the runtime fails the same way, so settle the cause with the mail administrator first.
  4. Enter those values into the runtime's mail configuration by copying them, not retyping from memory. On WinCC Unified that is the global email settings described in the next section.
  5. Bind the send to a rising edge: a button press or a single alarm-arrival event, never a condition that stays true. The worked example below puts numbers on that rule.
  6. Start the runtime and trigger once. At the moment of the trigger, expect a TCP connection from the runtime station to the relay's port in the firewall log and an accepted submission in the relay log; no connection at that moment means the trigger or the mail function never executed.
  7. Trigger ten times at the intended rate and expect ten distinct messages with no duplicates. Reboot the runtime station and trigger again without opening any editor; an identical result proves no credential or setting depended on a logged-in desktop session.

Where the SMTP data lives in the runtime #

WinCC Unified PC Runtime keeps the SMTP servers it sends mail through in the runtime's global email settings, and its documentation gives 25 as the default port there, so a relay that demands 587 with STARTTLS fails while that default stands. Runtime Advanced and the panel-class runtimes expose only the mail function their function list documents, so check the function list for your exact runtime type and TIA Portal version before configuring anything. Where no mail function exists at all, the send has to come from outside the runtime: a script on a PC-based station, a small helper program, or a PLC-side or PC-side service that owns the SMTP session and receives the event from the HMI.

Counting sends for a level condition true for 30 seconds #

Inputs, each an example value you replace with your own reading:

  • Evaluation cycle of the send script: 1 s, the schedule assigned to the cyclic task.
  • Time the condition stays true: 30 s, one alarm that clears after half a minute.
  • Rising-edge transitions during the event: 1.

The rule: a send bound to a level condition executes at every evaluation while the condition reads true; a send bound to an edge executes only on the false-to-true transition.

The arithmetic: evaluations during the event = 30 s ÷ 1 s = 30, so a level-bound send fires 30 times; an edge-bound send fires once; duplicates avoided = 30 - 1 = 29. A 60 s send lockout reaches the same single message per event, because the first evaluation sends and the lockout blocks the remaining 29 while exceeding the true period.

The result: without edge logic, one event puts 30 copies of one message in the mailbox and can get the sender blocked as spam; with the edge, or with that lockout, one event sends one message.

The decision: any condition that can hold true longer than one evaluation cycle gets a rising-edge trigger or a lockout longer than the longest true period it can produce, which with these numbers means longer than 30 s. A button press or a single alarm-arrival event is already an edge, which is why the procedure binds to one.

Pitfalls that survive a correct configuration #

  • Sends on screen-open events. A send that waits on an unreachable relay stalls the script that called it, so keep mail off screen-open events and out of time-critical scripts.
  • Two adapters, two gateways. A station with a PLC-side adapter and an office-side adapter needs its default gateway on the office side only; two gateways produce intermittent reachability, and a station that reaches the PLC but not the relay usually has an interface fault of that family, as a WinCC runtime that connects to the PLC only via TIA Portal walks through for one case.
  • Credentials in the project file. Store a dedicated send-only account with minimal rights, or use a relay restricted to the runtime station's address, so a copied project never exposes a real mailbox.
  • Email is best-effort delivery with no guaranteed arrival time. Keep local annunciation and acknowledgment in the HMI for anything safety-relevant, and treat mail as a convenience channel, never the only alarm path.

Questions asked

Can I test the mail path from my laptop instead of the runtime station?

No. The test only means something on the machine that will send the mail. A laptop on another VLAN, with a different gateway or firewall rules, can reach the relay while the runtime station cannot. Run the TCP test on the runtime station itself and trust only a True result from that machine, then configure the project to the values that produced it.

Does the runtime need internet access to send mail?

No. The runtime needs one outbound TCP session to the relay your administrator names, on that relay's port. Everything beyond the relay, from internet routing to spam filtering and the recipient's server, is the mail system's job. A relay inside the plant network is the cleanest target because the runtime station never has to leave the plant segment.

The relay accepts the message but nothing arrives. What comes next?

Work the delivery side, because the runtime's part is done. Check the relay's queue and delivery logs, confirm the recipient address, and test against a mailbox you control. A submission the relay accepted that never lands is almost always spam filtering at the receiving side or a wrong address, and the relay's administrator can trace the accepted message to where it stopped.

What happens to a send while the relay or the network is down?

The send fails and the runtime reports the mail function or script error, because HMI email has no store-and-forward queue of its own. Log the event in the PLC so the record survives the outage, and let a periodic edge retry the send once the relay answers again. That retry logic, not the mailbox, is what carries an alarm through a network failure.

Keep reading

  • Troubleshooting

    Why an HMI sends email in simulation but not from the panel

    Email that leaves from PC simulation but never from the physical panel means the project logic works and the panel's own send path is broken. Work the panel's chain in order: count and send condition, gateway, DNS and mail-server reachability, then the deployed project's email options, changing one option at a time. In the case behind this pattern, one checked option in the panel's email settings was the entire fault.

    HMI and touchscreens

  • How-to

    Fixing a WinCC PC station download comms error from TIA Portal V13

    When TIA Portal V13 compiles but the download to a WinCC PC station fails, the transfer channel to the runtime loader is broken while the HMI itself is healthy. Compile to file, copy the .hmi PData file to the path shown in the WinCC Runtime Loader settings, restart runtime from the loader, then align the firewall, channel settings and PC station IP to restore normal downloads.

    HMI and touchscreens

  • How-to

    Run a TIA Portal V14 HMI on WinCC Runtime Advanced

    Compile the HMI for its configured WinCC RT Advanced target, transfer the compiled application, and select it in RT Loader. Match the configured device version to the runtime installed on the workstation. Verify Windows support and use a valid runtime license sized for the application.

    HMI and touchscreens

Why PanelBuilder32 Cannot Reach a PanelView 1000 Over Ethernet