Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

CnfEmail

  • Last UpdatedOct 29, 2026
  • 3 minute read

CnfEmail is a built-in function that configures the email settings used by other features in the project that can send email, such as Alarm worksheets and the SendEmail and SendEmailExt functions.

Function

Group

Execution

String Exp.

Windows

Windows Embedded

IoT View

Thin Clients

Mobile Access

CnfEmail

Email

Synchronous

No

Supported

Supported, except for encryption

Not supported

Supported

Executed on Server

Syntax

CnfEmail(strSMTP, strFrom, strPOP3, strUser, strPassword, optNumTimeout, optNumAuthType, optStrSMTPUser, optStrSMTPPassword)

strSMTP

The hostname or IP address of the outgoing email server, which is also known as the SMTP server. You can include a port number if the server does not use one of the standard SMTP ports.

Note: For projects that will run on Windows Embedded devices, you must specify an IP address.

strFrom

The email address from which emails will be sent and at which emails may be received. This should be a valid address on the POP3 server (see strPOP3 below).

strPOP3

The hostname or IP address of the incoming email server, which is also known as the POP3 server. You can include a port number if the server does not use one of the standard POP3 ports.

If you are developing your project to run on Windows Embedded devices, you must specify an IP address.

strUser

The username to be used to log onto the POP3 server.

strPassword

The password to be used to log onto the POP3 server.

optNumTimeout

The timeout limit (in seconds) to be used when sending email. If no response is received from the SMTP server within this period of time, then the operation is aborted.

This is an optional parameter; if no timeout is specified, then the project will keep trying forever until it receives a response. You should specify some timeout, however, to make sure that your project will not freeze.

optNumAuthType, optStrSMTPUser, optStrSMTPPassword

Most outgoing mail servers require authentication to prevent spamming and other problems from unknown users. If your server requires authentication, set optNumAuthType to 1 (unencrypted), 2 (encrypted via TLS/SSL), or 3 (encrypted via STARTTLS). Then specify the username and password as optStrSMTPUser and optStrSMTPPassword, respectively. (If your SMTP username and password are the same as your POP3 username and password, then you can omit optStrSMTPUser and optStrSMTPPassword because the project will automatically use the values from strUser and strPassword.)

Note: Encryption via TLS/SSL is not supported in projects running on Windows Embedded devices.

Return value

Value

Description

0

Success

1

Invalid format for strSMTP

2

Invalid format for strFrom

3

Invalid format for strPOP3

4

Invalid format for strUser

5

Invalid format for strPassword

6

Invalid format for optNumTimeout

7

Wrong number of parameters

8

Error getting host IP address (invalid POP3 server)

9

Error connecting to POP3 server

10

Error sending username

11

Error sending password

12

SMTP server does not support selected authentication mode

13

Invalid SMTP username

14

Authentication failed

Notes

The email configuration created by this function works only within the Windows process where the function was called.

For example, if you place a Button object in a screen and then set the object to call this function when it is pressed, the resulting email configuration will work only on the Client station where the screen is displayed and the button is pressed. It will not work on any other Client stations nor on the Server station, because the project viewer running on the Client station only exchanges data (changes in tag values) with the data server running on the Server station. One cannot directly call functions on the other; it can only use triggers to force the other to call functions. Please note that is true even when the Client station and the Server station are the same physical device, because the project viewer and the data server are two separate processes in Windows.

If you want an email configuration to apply to your project's background tasks โ€” for example, to be able to send emails when alarms become active โ€” then you must either use the E-mail Settings dialog to configure default settings for the entire project or call this function from the project VBScript Startup Script, a VBScript scripts (script groups), or a Math worksheet.

Examples

CnfEmail("smtp.company.com", "Robert@company.com", "pop.company.com", "RobertH", "Shades556", 100)

CnfEmail("smtp.company.com:4455", "Robert@company.com", "pop.company.com:9900", "RobertH", "Shades556", 5,1 )

CnfEmail("195.11.22.33:4455", "Robert@company.com", "195.66.77.88:9900", "RobertH", "Shades556", 5, 2, "JohnS", "abcd1234")

In This Topic
Related Links