Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.mail
Interface MailService

All Superinterfaces
  javax.ejb.EJBObject, Remote

    public interface MailService

extends javax.ejb.EJBObject

Remote interface to the MailService stateless session bean. This bean provides basic mail-sending capabilities for sending text email messages.

The smtp server can be specified in the bean's deployment descriptor, or in the application's `MailServiceBean`.

Method Summary
`void` | `addToBatch(MailMessage message, String batch)` Add a MailMessage to a batch so that it can be sent later.
`void` | `deleteBatch(String batch)` Delete a batch and all of its messages
`ArrayList` | `getBatchNames()` Return all batch names in the system
`int` | `getBatchSize(String batch)` Return the size of a batch.
`ServletResults` | `getJSPResults(String url, Map params)` Similar to getTextFromJSP; but will retrieve contents of the jsp page as a byte array to cut down on string encoding hassles.
`ArrayList` | `getMessagesInBatch(String batchName, boolean getText)` Retrieve all messages in a batch.
`String` | `getTextFromJSP(String url, Map params)` Generate text from a JSP page for use in an email message.
`boolean` | `isValidAddress(String address)` Is the specified email address valid for this mail service.
`void` | `sendBatch(String batch, boolean delete)` Send all the messages in a batch, optionally deleting the batch when finished.
`void` | `sendMail(MailMessage message)` Send an email message immediately.
`void` | `sendMail(String to, String from, String subject, String text)` The simplest way to send a mail message; supply the basic information and the message will be sent immediately.

Methods inherited from interface javax.ejb.EJBObject
`getEJBHome, getHandle, getPrimaryKey, isIdentical, remove`

Method Detail

### isValidAddress

    boolean isValidAddress(String address)
                           throws RemoteException

  Is the specified email address valid for this mail service.

  Parameters
    `address` - the email address.
  Throws
    `RemoteException`

### sendMail

    void sendMail(String to,
                  String from,
                  String subject,
                  String text)
                  throws RemoteException,
                         IllegalArgumentException,
                         MailServiceException

  The simplest way to send a mail message; supply the basic information and the message will be sent immediately.

  Parameters
    `to` - The address to mail to
    `from` - The "from" address
    `subject` - The message's subject. Can be null.
    `text` - The message's text. Can be null.
  Throws
    `IllegalArgumentException` - If the "to" address is null or invalid
    `RemoteException`
    `MailServiceException`

### sendMail

    void sendMail(MailMessage message)
                  throws RemoteException,
                         IllegalArgumentException,
                         MailServiceException

  Send an email message immediately. A valid MailMessage is required; i.e., there must be at least one recipient.

  Parameters
    `message` - A MailMessage to send.
  Throws
    `IllegalArgumentException` - if the MailMessage is not valid
    `RemoteException`
    `MailServiceException`

### addToBatch

    void addToBatch(MailMessage message,
                    String batch)
                    throws RemoteException,
                           IllegalArgumentException,
                           MailServiceException

  Add a MailMessage to a batch so that it can be sent later. If the specified batch does not exist, it will be created.

  Parameters
    `message` - A MailMessage to batch
    `batch` - the name of the batch to add it to
  Throws
    `IllegalArgumentException` - if the MailMessage is not valid
    `RemoteException`
    `MailServiceException`

### sendBatch

    void sendBatch(String batch,
                   boolean delete)
                   throws RemoteException,
                          MailServiceException

  Send all the messages in a batch, optionally deleting the batch when finished.

  Parameters
    `batch` - the name of the batch to send
    `delete` - if true, will delete the batch after sending it
  Throws
    `RemoteException`
    `MailServiceException`

### deleteBatch

    void deleteBatch(String batch)
                     throws RemoteException,
                            MailServiceException

  Delete a batch and all of its messages

  Parameters
    `batch` - the name of the batch to delete
  Throws
    `RemoteException`
    `MailServiceException`

### getMessagesInBatch

    ArrayList getMessagesInBatch(String batchName,
                                 boolean getText)
                                 throws RemoteException,
                                        MailServiceException

  Retrieve all messages in a batch. If the getText flag is false, all message information will be retrieved except for the message text. This option is provided to avoid memory/bandwidth problems for batches that may contain large mail messages.

  Parameters
    `batch` - the name of the batch to examine
    `getText` - flag to retrieve message text
  Returns
    an ArrayList of MailMessage objects
  Throws
    `RemoteException`
    `MailServiceException`

### getBatchSize

    int getBatchSize(String batch)
                     throws RemoteException,
                            MailServiceException

  Return the size of a batch.

  Parameters
    `batch` - the name of the batch to examine
  Returns
    the number of messages in the batch
  Throws
    `RemoteException`
    `MailServiceException`

### getBatchNames

    ArrayList getBatchNames()
                            throws RemoteException,
                                   MailServiceException

  Return all batch names in the system

  Returns
    an ArrayList of batch names
  Throws
    `RemoteException`
    `MailServiceException`

### getTextFromJSP

    String getTextFromJSP(String url,
                          Map params)
                          throws RemoteException,
                                 IOException

  Generate text from a JSP page for use in an email message. Any parameters will be passed as HTTP POST parameters. If the URL is relative, it will be assumed it is an HTTP request to the local server, at the local server's port.

  Parameters
    `url` - the URL of the jsp page.
    `params` - a map of parameters to pass to the JSP
  Returns
    the generated text
  Throws
    `RemoteException`
    `IOException`

### getJSPResults

    ServletResults getJSPResults(String url,
                                 Map params)
                                 throws RemoteException,
                                        IOException

  Similar to getTextFromJSP; but will retrieve contents of the jsp page as a byte array to cut down on string encoding hassles. The ServletResults object also includes the content-type directive of the JSP page, if any is given.

  Throws
    `RemoteException`
    `IOException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2008, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its affiliates.
Other names may be trademarks of their respective owners.