Install the Email V1.1.5 service:
Download the EmailV115.zip/tar
file from Get Services for STAF V2
into a local directory (e.g. C:/STAF/services or /usr/local/staf/services) and extract it.
Configure the Email service:
Add the following statement to your staf.cfg file:
service <EmailName>
LIBRARY JSTAF EXECUTE <Service Jar File Name>
PARMS
MAILSERVER <mailserver> [PORT <mailport>] [DEBUG]
where:
-
<EmailName>
is the name by which the Email service will be known on this machine.
-
<Service Jar File Name>
is the fully-qualified name of the STAFEmail.jar file.
-
MAILSERVER <mailserver>
is the mail server through which the email will be sent. This parameter
is required. Some IBM-internal examples of valid mail servers are na.relay.ibm.com and westrelay.us.ibm.com.
-
PORT <mailport>
is the port through which the mail server will be accessed. This
parameter is optional (the default port is 25).
-
DEBUG indicates
that debug messages should be displayed for SEND
requests.
Examples:
service email LIBRARY
JSTAF EXECUTE c:/staf/services/STAFEmail.jar PARMS "MAILSERVER na.relay.ibm.com"
service email LIBRARY
JSTAF EXECUTE /usr/local/staf/services/STAFEmail.jar PARMS "MAILSERVER
westrelay.us.ibm.com PORT 25"
The Email service provides the following requests:
-
SEND - Send an email message to a list of recipients.
-
HELP - Displays a list of requests for the Email service and how to use
them.
SEND send an email message to a list of recipients
Syntax
SEND TO <address> ...
[SUBJECT <subject>] < MESSAGE <message> | FILE <file> [MACHINE machine] >
TO specifies
an email address to which the email will be sent. You may specify
multiple TO
options. This option will resolve variables.
SUBJECT
specifies subject of the email and is optional. This option will resolve variables.
MESSAGE
is the body of the email. This option will resolve variables.
FILE
is the file which contains the body of the email. This option will resolve variables.
MACHINE
is the machine where the
FILE is located. If not specified, it assumes the file is
on the machine submitting the EMAIL SEND request. This option will resolve variables.
Security
This request requires at least trust level 3.
Results
Upon successful return, the result buffer will be empty.
Examples
Goal: Send an email message to 2 email addresses:
staf local email send
to user1@us.ibm.com to user2@us.ibm.com message "Hello, this is the new
STAFEmail Service\n\nThanks" subject "Introducing the new STAFEmail Service"
Goal: Send an email message where the body of the email message is
in c:/results/testoutput.txt:
staf local email send
to user3@us.ibm.com file c:/results/testoutput.txt
VERSION displays the Email Service version.
Syntax
VERSION
Results
The result is the version number of the Email service.
HELP displays the request options and how to use them.
Syntax
HELP
Results
The result buffer contains the Help messages for the request options for
the Email service.