: Class SmtpAgent

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ## TsBiff 1.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ts.mail
Class SmtpAgent

    java.lang.Object
      |
      +--ts.mail.AbstractMailServer
            |
            +--ts.mail.SmtpAgent

All Implemented Interfaces:
  SafeTerminate, TransportAgent

public class SmtpAgent
extends AbstractMailServer
implements TransportAgent

This class extends the abstract Mailserver and implements the TransportAgent interface. The class (sub)implements the SMTP protocol for sending a mail message.

Version:
  $Id: SmtpAgent.java,v 1.10 1999/11/28 01:27:10 hauk Exp $
Author:
  Jan-Henrik Haukeland <hauk@tildeslash.com>
See Also:
  `AbstractMailServer`, `TransportAgent`, `MailModel`

Field Summary
`protected static int` | `DEFAULT_PORT` Default portnumber for the SMTP protocol
`protected static java.lang.String` | `PROTOCOL` Mail Transport Protocol used by this class

Fields inherited from class ts.mail.AbstractMailServer
`myMailServer, myMailServerPortNumber, SO_TIMEOUT`

Constructor Summary
`SmtpAgent()` Initializes the object using localhost and default portnumber
`SmtpAgent(java.lang.String aServer, int aPort)` Initializes the object with the given values for the mail server

Method Summary
`boolean` | `canTerminate()` Implementation of the SafeTerminate interface
`java.lang.String` | `getProtocol()` Implementation of super class abstract method.
`void` | `sendMail(MailModel aMail)` Implementation of sendMail method.

Methods inherited from class ts.mail.AbstractMailServer
`closeConnection, getInputStream, getMailServer, getMailServerName, getMailServerPortNumber, getOutputStream, openConnection`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_PORT

    protected static final int DEFAULT_PORT

  Default portnumber for the SMTP protocol

### PROTOCOL

    protected static final java.lang.String PROTOCOL

  Mail Transport Protocol used by this class

Constructor Detail

### SmtpAgent

    public SmtpAgent()
              throws java.net.UnknownHostException

  Initializes the object using localhost and default portnumber
  Throws:
    `java.net.UnknownHostException` - Is thrown if no IP address for the localhost could be found

### SmtpAgent

    public SmtpAgent(java.lang.String aServer,
                     int aPort)
              throws java.net.UnknownHostException

  Initializes the object with the given values for the mail server
  Parameters:
    `aServer` - The MTA server address
    `aPort` - The MTA server port number
  Throws:
    `java.net.UnknownHostException` - Is thrown if no IP address for the host could be found

Method Detail

### canTerminate

    public boolean canTerminate()

  Implementation of the SafeTerminate interface
  Specified by:
    `canTerminate` in interface `SafeTerminate`
  Returns:
    true if it's safe to terminate

### sendMail

    public void sendMail(MailModel aMail)
                  throws SendMailException

  Implementation of sendMail method. This method connects to the mail server's sendmail port and tries to send an ordinary SMTP message
  Specified by:
    `sendMail` in interface `TransportAgent`
  Throws:
    `SendMailException` - Is thrown if the mail for some reason could not be sent

### getProtocol

    public java.lang.String getProtocol()

  Implementation of super class abstract method.
  Specified by:
    `getProtocol` in interface `TransportAgent`
  Returns:
    The protocol used

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| ## TsBiff 1.3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD