Configuring Mail and Sending Emails
You configure the Mail Module for a default SMTP
server and From
address, these values can be overridden in the System_Mail_Send process definition. Once you have configured the Mail Module, you can use the process definition System_Mail_Send to send email. The process definition is designed to be included in chain definitions to email output from other chain processes in the chain and optionally in a step which is only executed when a chain process has reached status Error.
You configure the Mail Module with the process definition System_Mail_Configure.
Prerequisites
- Mail Module requires the Module.Mail license key
- A secure gateway if you wish to use your internal SMTP server. Not required for publicly accessible SMTP servers.
note
The notification and alerting features of the Mail module require you to configure every job chain that is to use these features. If you make extensive use of alerts and/or notifications, Redwood recommends the Active Monitoring module, as you can configure alerts and notifications centrally.
SMTP Authentication
Redwood Server supports SMTP authentication when the SMTP username and password are stored in a credential using the smtp credential protocol. Redwood Server looks up the credential with the virtual user, which must be set to default, and the SMTP server (endpoint), which must match the value in the /configuration/jcs/mail/Server
registry entry (the match is case-sensitive). You will have to create the smtp credential protocol (the name is case-sensitive) prior to creating the credential.
Procedure
Configuring the Mail Module with SMTP server detection
- Navigate to "Definitions > Processes".
- Choose Submit from the context-menu of the process definition System_Mail_Configure.
- Fill in a valid From email address and choose Submit.
Configuring the Mail Module without SMTP server detection
- Navigate to "Definitions > Processes".
- Choose Submit from the context-menu of the process definition System_Mail_Configure.
- Fill in a valid From email address, the Fully Qualified Domain Name of the SMTP server into the Server and choose Submit.
- Choose Save & Close.
Configuring SMTP Authentication
- Navigate to "Security > Credentials".
- Choose New Credential from the context-menu.
- Fill
smtp
into the Credential Protocol field,default
into the virtual user field, the SMTP server hostname into Endpoint, and the username/password into the respective fields. Note that the value in the Endpoint field must match the value in the/configuration/jcs/mail/Server
registry entry (case-sensitive). - Choose Save & Close.
Sending an email
- Navigate to "Definitions > Processes".
- Choose Submit from the context-menu of the process definition System_Mail_Send.
- Fill in a valid To email address and Subject and choose Submit.
Creating a basic notification scenario
- Navigate to "Definitions > Chains".
- Choose New Chain Definition from the context-menu.
- On the Chain tab, enter a valid name for the chain.
- On the Chain tab, choose Add Step from the context-menu of the chain.
- Choose Add Chain Process from the context-menu of the step and specify a process definition, fill in any parameters that are required.
- Repeat the previous step(s) for all process definitions that you require to be executed in this chain.
- Add another step as described above, for each chain process for which you want notification, create a separate chain process for running the process definition System_Mail_Send. Fill in the parameters as required.
- Choose Save & Close.
Creating a basic alerting scenario
- Navigate to "Definitions > Chains".
- Choose New Chain Definition from the context-menu.
- On the Chain Definition tab, enter a valid name for the chain.
- On the Chain Definition tab, choose Add Step from the context-menu of the chain.
- Choose Add Chain Process from the context-menu of the step and specify a process definition, fill in any parameters that are required.
- Repeat the previous step(s) for all process definitions that you require to be executed in this chain.
- Add another step as described above, for each chain process for which you want alerting, create a separate chain process for running the process definition System_Mail_Send. Fill in the parameters as required.
- Add a Status Handler on the chain, if you want an error in any chain process to trigger the alert, or on step-level for the required steps.
- Select the parent or the step.
- Expand Default Status Handlers or Status Handlers, expand the statuses for which you want to send an alert.
- For each status, select
Goto Step
in the Action Field and select the step containing the chain processes for alerting in the Goto Step field. - On the last step before the notification step, expand Status Handlers, expand the status Completed and select Mark Chain Completed in the Action field. This makes sure the alerting step is not executed when no chain process reached Error.
- Expand Status Handlers of the alerting step, expand the status Completed and select Raise Error in the Action field, fill Message and Exit Code fields appropriately.
- Choose Save & Close.
Example
Creating a basic alerting scenario
- Navigate to "Definitions > Chains".
- Choose New Chain Definition from the context-menu.
- On the Chain tab, enter name
JC_BasciAlert
for the chain. - On the Chain tab, choose Add Step from the context-menu of the chain.
- Choose Chain Process from the context-menu of the step and specify the process definition System_Info in the Process Definition field.
- Choose Add Step from the context-menu of the chain definition.
- Choose Chain Process from the context-menu of the new step and specify the process definition System_Mail_Send in the Process Definition field.
- Select the chain definition.
- Expand Default Status Handlers, expand the status Error, Canceled and Killed.
- For each status, select
Goto Step
in the Action Field and the step Step 2 in the Goto Step field. - Expand the status Completed and select Mark Chain Completed in the Action field.
- Expand Status Handlers of the step Step 2, expand the status Completed and select Raise Error in the Action field, fill
An error occurred in the chain
in the Message and123
into the Exit Code field. - Choose Save & Close.
Testing the alerting scenario
- Navigate to "Definitions > Chains".
- Choose Submit from the context-menu of the chain definition JC_BasciAlert.
- On the Times and Dates page of the submit wizard, add 3 minutes to the Requested Start Time field value and choose Next.
- On the Scheduling page, fill
System
into the Queue field and choose Submit. - Navigate to "Monitoring > Processes".
- Expand the chain (you might have to refresh the view), drill down to the first step, choose Scheduling > Cancel from the context-menu of the chain process of step Step 1.
- Wait until the chain completes.