Java Email Output Adapter

The Java Email Output adapter sends email to the specified recipient(s). When a row is received by this Adapter, the Row information is put into the body of an email message and then sent out.

The Java Email Output adapter is an out-of-process adapter.

Set your CLASSPATH environment variable according to the instructions in Setting Up Your Environment. The instructions for setting CLASSPATH apply to all out-of-process Java adapters, whether provided by or written by you.

To run this adapter, execute the following command:


java com.sybase.c8.adapter.EmailOutputAdapter <parameters>

Each parameter is of the form

--<paramname>=<paramvalue>

Note that "--" (two dashes) must precede each parameter name.

For example, the beginning of such a command line looks similar to the following:


java com.sybase.c8.adapter.JavaEmailAdapter --url= ...

Use the command-line parameters shown in the table below. These parameters are case-sensitive.

Parameter

Description

Required?

url

The CCL URL of the stream to read from.

Required

smtpHost

This is the name of the SMTP host.

Required

from

The email address that the email message will show the email as being from.

Required

to

The email address(es) to send the messages to.

Required

subject

The email subject.

Optional

body

The body of the message. (Note that you may use either the "--body" or the "--bodyFile" option, but not both.)

Optional

bodyFile

A file that contains the body of the message. (Note that you may use either the "--body" or the "--bodyFile" option, but not both.)

Optional

smtpPort

The port that the SMTP program uses to communicate.

Optional

smtpUsername

The user name.

Optional

smtpPassword

The password.

Optional

useTLS

Use a TLS secure connection when connecting to the mail server. This option works only if your mail server supports a TLS connection. You can use either the "--TLS" option or the "--SSL" option, but not both.

Optional

useSSL

Use an SSL connection when connecting to the mail server. This option works only if your mail server supports an SSL connection. You can use either the "--TLS" option or the "--SSL" option, but not both.

Optional

timeout

SMTP timeout in milliseconds.

Optional

timeFormat

The date format in the format of java.text.SimpleDateFormat.

Optional

It is possible to insert values from the stream into the subject and body of the message. Do this by including variables in the subject or body. A variable is the name of a field, with a question mark immediately preceding that field. For example, if you want to insert the value of the field named Price into the body of the message, then put ?Price in the body. Your body might look like:

The price reached ?Price.

It is also possible to insert values from the stream into the "to" field -- in other words, to specify to whom the message should be sent. Below is an example command line that starts the server and specifies that the "to" field should come from the stream:


java com.sybase.c8.adapter.EMailOutputAdapter ... --to=?ContactField ...

The message will be sent to the person whose email address is specified in the "ContactField" column of the stream.

SSL uses a secure connection from the beginning, while TLS is a method provided by some servers to allow an unencrypted connection to connect and negotiate an encrypted connection for the remainder of that session a port that may also allow non-secure traffic. Depending on how the server is configured, it may require that the session be escalated to an encrypted connection before anything of importance can be done over it. This method allows a mail server to use a single port for both non-encrypted and encrypted traffic, rather than requiring separate ports for encrypted and non-encrypted traffic.

If you do not specify either the -body or the -bodyfile option, then the body of the email message will contain the XML representation of the Sybase CEP row/message that arrived at the adapter.