IIoT - Mail Support


This library contains function blocks for sending, receiving, and deleting emails by means of SMTP and POP3 protocols.

Communication with the mail server can be established either encrypted (TLS) or unencrypted. A sample project demonstrates how to use the function blocks.

alternate text


The P2CDS-622 will only support Outbound emails and does NOT accept inbound for security reasons. The example project show both.

Install IIoT Library

To access the free IIoT Library functions e.g. Web Client functions, you must install the IIoT Single license with the CODESYS Installer.

This license is located on the CODESYS website store at IIoT License


This Library does NOT require any payment to download! Just click on the Download button.



To do this project, the steps outlined in the previous section Preparation have to be completed successfully.

The following project is a modified version taken form the IIoT Library example located in your install directory. This location for example would be at C:Users<username>Mail Service SL along with an associated Help file.

The Mail project can be downloaded in *Archive* format here- Mail project.

(1). With CODESYS IDE launched, click File > Project Archive > Extract Archive. Select all options in pop-up. Click “yes” on next pop-ups.

Update everything (including Library’s) to latest revisions. You may need to add a Library, e.g. Basic OSCAT.

The areas for the user to setup are shown below which include:
  • SMTP UserName

  • SMTP Server address

  • SMTP Password

alternate text

Mail send example:

alternate text

Received email example Gmail account (622plc@gmail.com)

alternate text

Items of Note

  • An email account for the P2CDS-622 named 622plc@gmail.com was created along with the associated password in sPassword to be used in the project. You will need to create your own email account.

  • This project uses Brevo for the SMTP server support- https://app.brevo.com/.

  • SMTP Port address is 587.

  • Error codes can be found in the Library documentation for this function.