DSSendMail
Use the DSSendMail function as an interface to a sendmail program that is assumed to exist somewhere in the search path of the current user (on the engine tier host). The function hides the different call interfaces to various sendmail programs, and provides a simple interface for sending text.
Syntax
Reply = DSSendMail(Parameters)
Parameters is a set of name:value parameters, separated by either a mark character or "\n".
Currently recognized names (case-insensitive) are:
- "From" Mail address of sender, for example, Me@SomeWhere.com
Can only be left blank if the local template file does not contain a "%from%" token.
- "To" Mail address of recipient, for example, You@ElseWhere.com
Can only be left blank if the local template file does not contain a "%to%" token.
- "Subject" Something to put in the subject line
of the message.
Refers to the "%subject%" token. If left as "", a standard subject line will be created, along the lines of "From InfoSphere® DataStage® job: jobname"
- "Server" Name of host through which the mail should
be sent.
might be omitted on systems (such as Unix) where the SMTP host name can be and is set up externally, in which case the local template file presumably will not contain a "%server%" token.
- "Body" Message body.
Can be omitted. An empty message will be sent. If used, it must be the last parameter, to allow for getting multiple lines into the message, using "\n" for line breaks. Refers to the "%body%" token.
Note: The text of the body might contain the tokens "%report% or %fullreport% anywhere within it, which will cause a report on the current job status to be inserted at that point. A full report contains stage and link information as well as job status.
Reply. Possible replies are:
- DSJE.NOERROR (0) OK
- DSJE.NOPARAM Parameter name missing - field does not look like 'name:value'
- DSJE.NOTEMPLATE Cannot find template file
- DSJE.BADTEMPLATE Error in template file
Remarks
The routine looks for a local file, in the current project directory, with a well-known name. That is, a template to describe exactly how to run the local sendmail command.
Example
code = DSSendMail("From:me@here\nTo:You@there\nSubject:Hi ya\nBody:Line1\nLine2")