MailServerAddress

Write Read TwinCAT TIA
Network E-Mail SmtpServerSettings

ns=2;s=DEPRAG Smart/Network/EMailClient/SmtpServerSettings/MailServerAddress

Address of the SMTP server.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bReadMailServerAddress
    A boolean variable that can be used to trigger the execution of the ReadMailServerAddress command.
    bWriteMailServerAddress
    A boolean variable that can be used to trigger the execution of the WriteMailServerAddress command.
    hrMailServerAddress
    This can be used to monitor the execution of the command. Error codes have the type "HRESULT".
    MailServerAddress
    A STRING(80) variable containing the address of the SMTP server.
    fbSmtpServerSettings
    An instance of the "FB_SmtpServerSettings" function block supplied with the DEPRAG Smart library.
    PointerToNodeValue
    A variable of type "POINTER TO BYTE" in which the address of the SMTP server is stored.
    SizeOfNodeValue
    A UINT variable containing the length of the SMTP server address.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
    bReadMailServerAddress      : BOOL;
    bWriteMailServerAddress      : BOOL;
    hrMailServerAddress       : HRESULT;
    MailServerAddress       : STRING(80);

    fbSmtpServerSettings      : FB_SmtpServerSettings;
END_VAR

hrMailServerAddress := fbSmtpServerSettings.ReadMailServerAddress(
      bExecute    := bReadMailServerAddress,
      ConnectionHandle  := depragSmartConnection.ConnectionHandle,
      Output    => MailServerAddress);
IF hrMailServerAddress <> S_FALSE THEN 
 bReadMailServerAddress := FALSE;
END_IF
  
hrMailServerAddress := fbSmtpServerSettings.WriteMailServerAddress(
      bExecute    := bWriteMailServerAddress,
      ConnectionHandle  := depragSmartConnection.ConnectionHandle,
      PointerToNodeValue  := ADR(MailServerAddress),
      SizeOfNodeValue  := SIZEOF(MailServerAddress));
IF hrMailServerAddress <> S_FALSE THEN 
 bWriteMailServerAddress := 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".