Server (FB)¶
FUNCTION_BLOCK Server EXTENDS CBM.ETrigTo
The server is essential to send, receive and delete emails. The Server must be started before any action can be performed.
- InOut:
Scope
Name
Type
Initial
Comment
Inherited from
Input
xExecute
BOOL
Rising edge: Action startsFalling edge: Resets outputsIf a falling edge occurs before the function block has completed its action, the outputs operate in the usual manner and are only reset if either the action is completed or in the event of an error. In this case, the corresponding output values (xDone
,xError
) are present at the outputs for exactly one cycle.ETrigTo
udiTimeOut
UDINT
Defines the time (µs) after which an FB (e.g. requiring an external acknowledgement) aborts operation due to a timeout with error message.
ETrigTo
Output
xDone
BOOL
TRUE
: Action successfully completedETrigTo
xBusy
BOOL
TRUE
: Function block activeETrigTo
xError
BOOL
TRUE
: Error occurred, function block aborts actionFALSE
: No errorETrigTo
Input
sPopServer
STRING
The name of the POP server.
uiPortPOP
UINT
110
The port of the POP server.
sSMTPServer
STRING
The name of the SMTP server.
uiPortSMTP
UINT
25
The port of the SMTP server.
eConnectionType
CONNECTION_TYPE.STD
Communication via TLS or standard, default: STD
xStartTLS
BOOL
Use STARTTLS for the SMTP connection (condition: eConnectionType = CONNECTION_TYPE.TLS)
itfTLSContext
NBS.ITLSContext
0
Encapsulates all the data neccecray to handle encrypted tcp connections
Static initialization, as shown in the following code snippet.
VAR commonName : STRING := 'MyRrasPi'; ciCertInfo : NBS.CERT_INFO := (psInfo:=ADR(commonName), udiSize:=LEN(commonName)); myTLSContext : NBS.TLSContext := ( ePurpose:=NBS.PURPOSE.CLIENT_SIDE, sUseCaseName:='NBSTest', sTLSVersion:='1.3', ciCertInfo:=ciCertInfo, udiVerificationMode:=2 ); END_VAR
itfAsyncProperty
NBS.IAsyncProperty
0
Runs the connect process in a own background task, usage see library Net Base Services
Output
eError
Local library error ID (0: no error; 5001: time out)