smtpGetConfig (Functionblock)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All

Firmware version:

1.50 (4.34: iface) / 1.00.00


This function will read out the SMTP configuration previously set by using the smtpSetConfig function.

 

 

Input:

None.

 

Output:

Status : SINT

0

- SMTP parameters are valid.

-13

- SMTP parameters are not set.

IP : STRING

The IP address of the email server.

 

Port : DINT

The port of the email server.

 

iface : SINT

The network interface to use. 0 = Default network, 1 = Mobile network, 2 = LAN network, etc. (See Network)

Note: For backwards compatibility the Mobile network is used as default network.

 

Sender : STRING

The mail address of the email sender.

 

Authenticate : BOOL

TRUE:

Authentication is enabled.

FALSE:

Authentication is not enabled.

 
Username : STRING

The user name the device should use in order to connect to the mail server.

 

Password : STRING

The password the device should use in order to connect to the mail server.

 

UseTLS : BOOT

TRUE:

Secure connection is enabled.

FALSE:

Secure connection is not enabled.

 

 

Declaration:

FUNCTION_BLOCK smtpGetConfig;
VAR_OUTPUT
  Status             : SINT;
  IP                 : STRING;
  Port               : DINT;
  iface             : SINT;
  Sender             : STRING;
  Authenticate       : BOOL;
  Username           : STRING;
  Password           : STRING;
  UseTLS             : BOOL;
END_VAR;

 

Example:

INCLUDE rtcu.inc
 
PROGRAM example;
VAR
  smtpParm : smtpGetConfig;
END_VAR;
 
// Check SMTP settings
smtpParm();
DebugMsg(message := "smtpGetConfig:");
DebugFmt(message := "-status=\1", v1 := smtpParm.status);
DebugMsg(message := "-host=" + smtpParm.IP);
DebugFmt(message := "-port=\4", v4 := smtpParm.port);
DebugFmt(message := "-iface=\1", v1 := smtpParm.iface);
DebugFmt(message := "-UseTLS=\1", v1 := SINT(smtpParm.UseTLS));
DebugMsg(message := "-sender=" + smtpParm.sender);
DebugFmt(message := "-auth=\1", v1 := SINT(smtpParm.authenticate));
DebugMsg(message := "-user=" + smtpParm.username);
DebugMsg(message := "-pass=" + smtpParm.password);
 
BEGIN
  ...
END;
END_PROGRAM;