Cronacle for SAP solutions
Mail Capabilities
Production
1
Course Objectives
You will be able to:
Understand the mail capabilities of the product
Configure the mail system
Use the System_Mail_Send job to
Send mail from jobs
Send mail from job chains using expressions
Create and use Mail Job Definitions to
Send formatted mail from jobs and job chains
Resend failed mail
2
Mail Capabilities
The mail capabilities are provided by two job definitions,
and the Mail Job Definition type
System_Mail_Configure – detect or configure your mail
server
System_Mail_Send – send simple mail
Mail Job Definition type – send advanced mail
These are dependent on the ‘Module.Mail’ key being
present in your license
3
Configuring mail
The mail system needs to be configured before it can be
used
Submit the System_Mail_Configure job, and specify the
‘From’ parameter
This is the from address that all mail from the scheduler will
use. Eg.
[email protected] This address will be used to detect the mail server
If the job runs to Completed, configuration is completed
If the job runs to Error, you will need to perform further
configuration
4
Configuring mail – dealing with errors
If the mail server cannot be detected, then
System_Mail_Configure will go into Error
If this happens you will need to specify the mail
server manually
The server needs to be an SMTP mail server that
accepts connections on TCP/IP port 25
Resubmit the System_Mail_Configure job and
specify both the ‘From’ and ‘Server’ parameters
The Server can either be a name or an IP address
5
Sending mail
You can send mail using the System_Mail_Send
job definition
This job definition can
Send a simple mail with a subject and text
Attach a Job file
Override the default mail server settings
6
Sending a simple mail
To send a simple mail, specify:
To – the address to send mail to
Subject – the message subject
Text – the message text (or message body)
The server and from address will come from the
global settings
7
Attaching files
You can attach a file to a mail using additional
parameters:
Relative job – the job to which the file belongs
Job File – the name of the job file
Relative job is used in job chains to specify the
output of another job (particularly in a previous
step)
Job file specifies the name of the job file (eg.
stdout or stderr)
8
Specifying the relative job
parent
the parent job
jobId
job jobId
a specific job id
name, job number
job number in the step called name, within the
current job chain. The job must be from a previous
step
9
Attaching a file in a job chain
10
10
Attaching a file in a job chain
Runtime view of chain
11
11
Attaching a file in a job chain
The user is sent a mail:
12
12
Overriding the default mail settings
You can override default mail settings:
Server – specify a different server
From – specify a different from address
13
13
Using mail for basic alerting
Mail and Redwood Expression Language (REL)
can be combined to build basic alerting
functionality
Enter expressions using REL variables in the
text and subject
Use specific error handling steps to send job
files
14
14
Using mail for basic alerting
15
15
Mail Job Definition
Advanced mail option
Can be used in place of the System_Mail_Send job
Allows mail template
HTML formatting
Parameter substitution
File attachments
Multiple files
Arbitrary server files
16
16
Mail Job Definition Parameters
Mail_To:
The destination email address
Required parameter
All Job Definition parameters are made
available through the parameter substitution in
the template
${Subject} will be filled in with the Subject Job
Parameter value
${JobId} and ${JobName} are filled in with the
Mail Job Id and Name respectively
17
17
Mail Template
Mail Script Type
Use this script type for
Substitution all Mail job definitions.
The Job Parameter
TimeNow will be
filled in here. Default Section
JobName and JobId All text before a
are automatically section declaration
filled in. is the body of the
mail. If there aren’t
any mail headers,
Comments body headers or
Empty lines and attachments this is
lines star ting with # all that needs to be
within sections will specified.
be ignored.
18
18
Mail Sections
Options
Options are
specified in the [Attachments]
format: Attach Job Files and
x=y arbitrary server files
No quoting of the to the mail.
text is necessary,
but options are
limited to one line.
[Headers]
Optional mail
header configuration
options. These are
passed through to [Body]
the mail system as This section allows
given. headers to be set on
the mail body.
19
19
Mail Template - Result
Formatting Attachments
Mail has been Attached files have
received in HTML the name as defined
format. in the template.
Substitution
Substitutions are
applied.
20
20
Mail Formatting
All text in the Default Section defines the body
of the mail
Content is in plain text by default
If the template starts with < it is assumed to be
HTML
Content-Type can be overridden by specifying
the Content-Type option in the Body section
e.g. Content-Type=text/xml
21
21
Mail Attachments Section
Defined by the [Attachments] token
name=file reference
name is the name of the file as attached to the
email e.g. report.html
File reference can be a Job File reference or an
arbitrary server file
22
22
Mail Attachment – Job File
name=relative job:job file
Rules from System_Mail_Send apply
e.g. report.html=Step 1, Job 1:report
report.html - the name of the attachment
Step 1, Job 1 - the relative job
report – the Job File from the relative job
23
23
Mail Attachment – Arbitrary Server File
name=server file
Reads a file from the server file
system
Access to directory has to
be granted
Access to paths defined as registry
entries under
/configuration/mail/AccessiblePath
Example:
maintenance.doc=/usr/SAP/trans/report/maintenance.doc
24
24
Mail Headers Section
Defined by [Headers] token
Add custom headers to the mail
Examples:
Subject=Job Report – mail subject
[email protected] – carbon copy
[email protected] – blind carbon copy
[email protected] – reply address
25
25
Mail Body Headers Section
Defined by [Body] token
Add custom headers to the mail body
Used to set the Content-Type of the body
content-type=text/html; charset=utf-8
26
26
Sending formatted mail in a job chain
Mail Job Definition Type
27
27
Mail Job Definition in job chain
28
28
Mail Job Definition in chain
Runtime view of chain
29
29
Mail Job Definition in chain
The user is sent a mail:
30
30
Resend Mail through Restart Behavior
31
31
Resend Mail through Restart Behavior
The job is rescheduled until the mail is sent
32
32
Exercises
33
33
For more information, go to:
http://www.redwood.com
http://support.redwood.com/
Redwood Software
Waterveste 3
3992 DB Houten
The Netherlands
Phone: +31 30 635 4555
34
Thank You
Redwood Software
Address Line 1
Address Line 2
Address Line 2
Tel:
Mob:
Name Email Address
Title www.redwood.com
35
35