FP_SMTP_SET_GROUP

Set destination group

This FP instruction sets the destination group.

Parameters

Input

sGroupNumber (WORD, INT, UINT)

Set the destination group number.

Values: 0–7

Example: 'GRPNO=3' specifies group 3 as the destination group.

sGroupName (STRING)

Set the destination group name (max. 64 characters).

Example: 'GRPNAME=Group3' sets "Group3" as the name of the destination group.

sEMailAddresses (STRING)

Set the e-mail address of a member belonging to a destination group (max. 256 characters). An e-mail address can be specified with a host name only or host name + domain name. If you omit the domain name here, you must specify it with sEMailDomain.

Examples:

  1. 'TO=user@support.com' sets "user@support.com" as the destination e-mail address. If the domain name is included here, you do not need to set a domain name with sEMailDomain.

  2. 'TO=user' and 'DOMAIN=support.com' set "user@support.com" as the destination e-mail address.

  3. 'TO=user@support.com,admin@helpcenter.com' sets two e-mail addresses at two different domains: "user@support.com" and "admin@helpcenter.com".

sEMailDomain (STRING)

Set the domain name (max. 32 characters). Only one domain name can be specified.

Setting a domain name allows you to omit the domain name in sEMailAddresses, which is helpful if you wish to set multiple e-mail addresses.

Examples:

  1. 'TO=user,admin,groupowner' and 'DOMAIN=support.com' set multiple e-mail addresses: "user@support.com", "admin@support.com", and "groupowner@support.com".

  2. 'TO=user@support.com,admin,groupowner' and 'DOMAIN=helpcenter.com' specifies multiple e-mail addresses in different domains: "user@support.com", "admin@helpcenter.com", and "groupowner@helpcenter.com".

Output

bError (BOOL)

Turns to TRUE under the following conditions:

  • if a timeout of the connection is exceeded

  • if an IP address is invalid

When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.

Remarks

  • Separate all keyword entries by comma. e.g. 'NAME=abcd,FROM=sender@server.com'

  • The number of characters for string data must not exceed 256.

  • This instruction is not available in interrupt programs.

  • Upper and lower case characters can be used for specifying keywords. However, the subject, the e-mail text, and the file name of the attachment are case-sensitive.

  • Before you execute the instruction, you need to specify the e-mail transmission server using FP_SMTP_SET_CONNECTION or the setting dialog of the SMTP client.

  • Before you execute the instruction, make sure that sys_bIsEthernetInitializing is FALSE. sys_bIsEthernetInitializing turns to TRUE when the instruction is executed. When you execute the instruction while sys_bIsEthernetInitializing is TRUE, an error occurs.

  • The instruction can only be executed when the transfer request flag for the specified transfer setting or the specified nLogID number is FALSE. When the transfer request flag is TRUE, an operation error occurs.

  • When this instruction has been executed successfully, the system variables sys_bIsCarry and sys_iEthernetConnectionErrorCode are reset.

  • When an error occurs, check the system variable sys_iEthernetConnectionErrorCode for the error code number.

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • if a value specified for a parameter is outside the permissible range.

  • if the instruction is executed in an interrupt program.

  • if the e-mail transmission request flag for the specified transfer setting is "TRUE: Transfer requested".

  • if the transfer request flag for a specified nLogID number is TRUE, e.g. if sys_blsLog0DataRecordingActive is TRUE.

  • if an e-mail transmission server that has not been specified with the instruction FP_SMTP_SET_CONNECTION or the setting dialog of the SMTP client is specified.

  • if no domain name has been set with sEMailDomain and the e-mail address set with sEMailAddresses is specified without domain name.

  • if the number of characters for string data exceeds 256.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • if a value specified for a parameter is outside the permissible range.

  • if the instruction is executed in an interrupt program.

  • if the e-mail transmission request flag for the specified transfer setting is "TRUE: Transfer requested".

  • if the transfer request flag for a specified nLogID number is TRUE, e.g. if sys_blsLog0DataRecordingActive is TRUE.

  • if an e-mail transmission server that has not been specified with the instruction FP_SMTP_SET_CONNECTION or the setting dialog of the SMTP client is specified.

  • if no domain name has been set with sEMailDomain and the e-mail address set with sEMailAddresses is specified without domain name.

  • if the number of characters for string data exceeds 256.

sys_bIsCarry (turns to TRUE for one scan)
  • if the instruction is executed during the initialization of Ethernet, sys_iEthernetConnectionErrorCode is set to "11: Ethernet is being initialized".

Example

POU header

All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.

	VAR
		bSetGroup: BOOL:=FALSE;
		bError: BOOL:=FALSE;
	END_VAR

POU body

If bSetGroup changes from FALSE to TRUE and sys_bIsEthernetInitializing is FALSE, the instruction is carried out.

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 10 ;
        NETWORK_BODY
B(B_CONTACT,,bSetGroup,4,1,6,3,R);
B(B_CONTACT,,sys_bIsEthernetInitializing,12,1,14,3,N);
B(B_VARIN,,'GRPNO=0',16,5,18,7,);
B(B_VARIN,,'GRPNAME=Grp0',16,6,18,8,);
B(B_VARIN,,'TO=user@support.com',16,7,18,9,);
B(B_VARIN,,'DOMAIN=',16,8,18,10,);
B(B_VAROUT,,bError,30,5,32,7,);
B(B_F,FP_SMTP_SET_GROUP!,,18,3,30,10,,?DEN?DsGroupNumber?DsGroupName?DsEMailAddresses?DsEMailDomain?AENO?CbError);
L(1,2,4,2);
L(6,2,12,2);
L(14,2,14,5);
L(14,5,18,5);
L(1,0,1,10);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

If DF(bSetGroup) AND NOT sys_bIsEthernetInitializing then
    FP_SMTP_SET_GROUP(sGroupNumber := 'GRPNO=0',
                      sGroupName := 'GRPNAME=Grp0',
                      sEMailAddresses := 'TO=user@support.com', 
                      sEMailDomain := 'DOMAIN=',
                      bError => bError);
End_if;

Modified on: 2024-03-06Feedback on this pagePanasonic hotline