Checking Notification Generation |
You can check how Notifier generates notifications from templates. For that purpose, use the notify command in the interactive management interface. Command format The command has the following syntax: notify type [mode] [-] [options] where : •type - notification type which is the same as the name of the used template file. It is allowed to use any type except for report.msg. •mode - notification mode which can be one of the following: oshow - generate a message from a template and output the notification text. Format of the output command: SIZE <FROM> <RCPT1> <RCPT2>... where: SIZE - size of the BODY in bytes. If BODY is not finished with a new line character, the character is added (but not included in SIZE), FROM - message sender (from the envelope), RCPT - message recipients (from the envelope), BODY - message body. For description of the procedure how recipients and sender are determined, see below. osync - generate a message from the template and send via Sender in the synchronous mode (that is, Sender delivers the message before the result is returned). If the used Sender does not support the synchronous mode, the message is sent in the asynchronous mode (see below). According to the results, a string on successful or failed sending of the generated notification is output. oasync - generate a message from the template and send via Sender in the asynchronous mode (that is, Sender receives the message for processing, but can send it later). If the used Sender does not support the asynchronous mode, the message is sent in the synchronous mode (see above). Sender must support operation at least in one of the modes. According to the results, a string on successful or failed sending of the generated notification is output. If the mode is not specified, it is set to show. •client-id - Client identifier for notification processing. If the '-' is specified, the identifier is treated as empty. Thus, the notify command allows to operate with one Client only.. •options - list of macros required to be initialized for the template (assigned values are used when generating a message). The list format is a set of the following pairs: NAME=VAL where NAME - macro name (without the surrounding $) and VAL assigned value enclosed in single quotation marks. The macro name and macro value are case insensitive. If the VAL value does not have empty spaces, the enclosing quotes can be omitted. If the VAL value is enclosed in quotes and the ' character is included in the value, the character must be escaped with the repeated ' character. Between NAME, '=' and VAL white spaces must not be specified. If several NAME=VAL pairs with the same NAME are specified, the NAME macro is treated as a list when processing the template. If, according to the template, the macro cannot be a list but is specified several times in the command, either its first value is used or all of the values are combined using commas (which is incorrect in most cases). After the command output, an empty line is always added. Macros Initialization Method In the list of macros for initialization, any of these macros can be used. For all macros, except for those described below, their default value is used. Values of macros used in the reports are not set automatically (the macros with the $RP_*$ name) . These macros must be explicitly initialized in a command. If a macro necessary for notification generation is not specified, the corresponding error is output to the Notifier log. Apart from macros, you can also use the following indicators as initialization parameters: •_FROM - sets a sender in the envelope (also used for searching parameter values in Rules that have sender: in the conditional part). For DSN templates, the sender is always empty. The method to determine a message sender is described below. If several values are specified, the first one is used. •_RCPTS - sets message recipients (also used for searching parameters in Rules that have rcpt: in the conditional part). This parameter can have a list as a value. The method to determine message recipients (for an envelope) is described below. •_BLOCK - sets names for malicious objects that blocked a virtual message for which notification is generated. This parameter can have a list as a value and is used in Rules that have block: in the conditional part. •_SIZE - sets size of a virtual message for which notification is generated, in bytes. This parameter is used for searching parameters in Rules that have size: in the conditional part. •_SCORE - sets a score of the message for which the notification is generated. This parameter is used for searching parameters in Rules that have score: in the conditional part. Sender- and Recipient-Determining Mechanism If special values of _FROM or _RCPTS are specified, the sender and recipients in the envelope are determined by these indicators only (except for DSN templates where the recipient is always empty). Otherwise, the following mechanism to determine sender and recipients is used: For welcome_user.msg and password_user.msg templates: •sender's address is determined according to the AdminMail parameter from Rules; •recipients' addresses - from the $RCPTS$ macro (thus, it must be initialized otherwise an error occurs). For welcome_client.msg and password_client.msg templates: •sender's address is set according to the value specified first for the AdminMail parameter in the configuration, ignoring the matching Rules. •recipients' addresses are determined according to the AdminMail parameter from the matching Rules. For DSN (dsn.msg or dsn_for_exchange.msg)templates: •sender's address is always empty •if the _FROM parameter is specified, the values specified first fro this parameter is set as the sender's address, otherwise, recipients' addresses are determined by the $RCPTS$ macro. If the _FROM parameter is not specified and the $RCPTS$ macro is not initialized, an error occurs. For other templates: •sender's address is set аaccording to the FilterMail parameter value from the matching Rules. •recipients' addresses - according to the $RCPTS$ macro (thus, the macro must be initialized, otherwise an error occur). Command Example Usage Output text of a message generated as DSN for the ai@drweb.com and test@drweb.com recipients notify dsn.msg show - _RCPTS=ai@drweb.com FULLHEADERS='From: <fake>' _RCPTS='test@drweb.com' Generate a message from the admin_virus.msg template and send the message in the synchronous mode notify admin_virus.msg sync - RCPTS=test FULLHEADERS='From: <fake>' |