ns=2;s=DEPRAG Smart/Network/EMailClient/Send
This command sends an e-mail message without attachments to all e-mail addresses stored in the MailAddressTo field. Before using the functionality, the SMTP server must be set in the SmtpServerSettings settings.
In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:
VAR
EmailAddressArray : ARRAY[1..50] OF STRING(255) := ['employee@example.com'];
bEMailClientSend : BOOL;
OutputDataEMailClientSend : ST_VoidOutputData;
hrEMailClientSend : HRESULT;
testShortByteArray : ARRAY[1..10] OF BYTE := [84, 101, 115, 116];
testLongByteArray : ARRAY[1..1000] OF BYTE := [84, 101, 115, 116, 255, 84, 255];
fbEMailClient : FB_EMailClient;
END_VAR
hrEMailClientSend := fbEMailClient.EMailClientSend(
bExecute := bEMailClientSend,
ConnectionHandle := depragSmartConnection.ConnectionHandle,
sMailAdressFrom := 'test@deprag.de',
MailAddressTo := EmailAddressArray,
nNumberOfAddressesToMailTo := 1,
sSubject := ADR(testShortByteArray),
SizeOfSubject := SIZEOF(testShortByteArray),
sContent := ADR(testLongByteArray),
SizeOfContent := SIZEOF(testLongByteArray),
OutputData => OutputDataEMailClientSend);
IF hrEMailClientSend <> S_FALSE THEN
bEMailClientSend := FALSE;
END_IF
For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".