Last updated: November 29, 2005
Installation and Configuration
SERVICE <EmailName> LIBRARY JSTAF EXECUTE <Service Jar File Name> \ PARMS MAILSERVER <mailserver> [PORT <mailport>] [DEBUG]where:
SERVICE email LIBRARY JSTAF EXECUTE c:/staf/services/email/STAFEmail.jar \ PARMS "MAILSERVER na.relay.ibm.com" SERVICE email LIBRARY JSTAF EXECUTE /usr/local/staf/services/email/STAFEmail.jar \ PARMS "MAILSERVER na.relay.ibm.com PORT 25" SERVICE email LIBRARY JSTAF EXECUTE c:/staf/services/email/STAFEmail.jar \ PARMS "MAILSERVER na.relay.ibm.com"
SEND TO <Address>... [FROM <user@company.com>] < MESSAGE <Message> | FILE <File> [MACHINE Machine] > [SUBJECT <subject>] [NOHEADER] [TEXTATTACHMENT <file>]... [BINARYATTACHMENT <file>]... [ATTACHMENTMACHINE <machine>]
TO specifies an email address to which the email will be sent. You may specify multiple TO options. This option will resolve variables.
FROM specifies an email address that the email will be sent from. If this option is not specified, the default from address will be STAFEmailService@<host name> where <host name> is replaced with the host name of the machine where the Email service that is sending the message is registered. This option will resolve variables.
MESSAGE specifies the body of the email. This option will resolve variables.
FILE specifies 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.
SUBJECT specifies subject of the email and is optional. This option will resolve variables.
NOHEADER indicates that the "DO NOT RESPOND TO THE SERVICE MACHINE THAT GENERATED THIS NOTE" header should not be included at the beginning of the email body. If this option is not specified, the header will be included at the beginning of the email body
TEXTATTACHMENT specifies a text file to attach to the email and is optional. You may specify multiple TEXTATTACHMENT options. This option will resolve variables.
BINARYATTACHMENT specifies a binary file to attach to the email and is optional. You may specify multiple BINARYATTACHMENT options. This option will resolve variables.
ATTACHMENTMACHINE is the machine where the attachments (if any) are located. If not specified, it assumes the files are on the machine submitting the EMAIL SEND request. This option will resolve variables.
STAF local EMAIL SEND TO user1@us.ibm.com message "Test XYZ completed successfully." SUBJECT "Test XYX: Success"
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"
STAF server1.company.com EMAIL SEND TO user3@us.ibm.com FILE c:/results/testoutput.txt
STAF local EMAIL SEND TO user5@us.ibm.com message "SVT completed successfully. Details are attached." SUBJECT "SVT: Success" TEXTATTACHMENT c:/output/SVTTests.txt
STAF local EMAIL SEND TO user6@us.ibm.com message "Here are the test results" SUBJECT "Test Results" TEXTATTACHMENT G:/projects/test/Results.html BINARYATTACHMENT G:/projects/test/DetailedResults.zip ATTACHMENTMACHINE server1.company.com
LIST SETTINGS
Definition of map class STAF/Service/Email/Settings | |||
---|---|---|---|
Description: This map class represents the settings for the Email service. | |||
Key Name | Display Name | Type | Format / Value |
mailServer | Mail Server | <String> | |
port | Port | <String> | |
Notes:
|
STAF server1.company.com EMAIL LIST SETTINGS
Output: If the request is submitted from the command line, the result could look like:
Mail Server: na.relay.ibm.com Port : 25
STAF server1.company.com EMAIL VERSION
Output:
3.1.2
STAF local EMAIL HELP
Output:
EMAIL Service Help SEND TO <Address>... [FROM <user@company.com>] < MESSAGE <Message> | FILE <File> [MACHINE Machine] > [SUBJECT <subject>] [NOHEADER] [TEXTATTACHMENT <file>]... [BINARYATTACHMENT <file>]... [ATTACHMENTMACHINE <machine>] LIST SETTINGS VERSION HELP
The Email service maintains a machine log where it writes an entry when the following occurs:
The logname for the Email service is the name under which the service is registered.
Here is an example of what a Email service log on the local machine with machine nickname client1 could look like (shown via a request from the command line in the table format):
C:\>STAF local LOG QUERY MACHINE client1 LOGNAME email Response -------- Date-Time Level Message ----------------- ----- -------------------------------------------------------- 20050611-16:05:36 Info email service initialized, using mailserver na.relay.ib m.com port 25 20050611-16:05:38 Info SEND TO [bdavid@us.ibm.com] FROM user SUBJECT This is a test TEXTATTACHMENTS [c:/temp/rc0.txt, c:/temp/perf.tx t] BINARYATTACHMENTS [c:/temp/staf1.gif] 20050611-16:05:38 Info 220 d01av01.pok.ibm.com ESMTP Sendmail 8.12.11/8.12.11; Sat, 11 Jun 2005 17:05:41 -0400 20050611-16:05:38 Info 250 d01av01.pok.ibm.com Hello dave2268.austin.ibm.com [ 9.53.53.168], pleased to meet you 20050611-16:05:38 Error 553 5.5.4 user... Domain name required for sender addre ss user 20050611-16:05:51 Info SEND TO [bdavid@us.ibm.com] FROM user@ibm.com SUBJECT T his is a test TEXTATTACHMENTS [c:/temp/rc0.txt, c:/temp /perf.txt] BINARYATTACHMENTS [c:/temp/staf1.gif] 20050611-16:05:51 Info 220 d01av01.pok.ibm.com ESMTP Sendmail 8.12.11/8.12.11; Sat, 11 Jun 2005 17:05:53 -0400 20050611-16:05:51 Info 250 d01av01.pok.ibm.com Hello dave2268.austin.ibm.com [ 9.53.53.168], pleased to meet you 20050611-16:05:51 Info 250 2.1.0 user@ibm.com... Sender ok 20050611-16:05:51 Info 250 2.1.5 bdavid@us.ibm.com... Recipient ok 20050611-16:05:51 Info 354 Please start mail input. 20050611-16:05:51 Info 250 Mail queued for delivery.
In addition to the common STAF return codes, the following Email
return codes are defined:
Table 1. Email Service Return Codes
Error Code | Meaning | Comment |
---|---|---|
4001 | IO Exception | An IO Exception occurred while sending the email. |
44XX 45XX |
SMTP Errors | The Email request generated an SMTP error. The SMTP error code is the last 3 digits of the error code. See section 4.2 in RFC 821 for an explanation of SMTP return codes (e.g. 450, 503, 553, etc). |
This product includes software developed by the Apache Software Foundation (http://www.apache.org/).
/* * The Apache Software License, Version 1.1 * * * Copyright (c) 1999-2004 The Apache Software Foundation. All rights * reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * 3. The end-user documentation included with the redistribution, * if any, must include the following acknowledgment: * "This product includes software developed by the * Apache Software Foundation (http://www.apache.org/)." * Alternately, this acknowledgment may appear in the software itself, * if and wherever such third-party acknowledgments normally appear. * * 4. The names "Xerces" and "Apache Software Foundation" must * not be used to endorse or promote products derived from this * software without prior written permission. For written * permission, please contact apache@apache.org. * * 5. Products derived from this software may not be called "Apache", * nor may "Apache" appear in their name, without prior written * permission of the Apache Software Foundation. * * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * ==================================================================== * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Software Foundation and was * originally based on software copyright (c) 1999, International * Business Machines, Inc., http://www.ibm.com. For more * information on the Apache Software Foundation, please see * <http://www.apache.org/>. */