All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class datarep.common.Email

java.lang.Object
   |
   +----datarep.common.Email

public class Email
extends Object
Email is a class which lets you send E-mail from within a java program. It requires acess to a SMTP server.
To sucessfully send E-mail, you must call the setServer, setTo and setFrom methods. The E-mail will be useful if the setSubject and setMessage methods are also called. Finally, be sure to call the send method, which actually sends the message.

Version:
1.2
Author:
Data Representations, Inc.

Constructor Index

 o Email()

Method Index

 o getFrom()
returns the current sender of the message.
 o getLastConversation()
returns the log of the messages sent to and from the SMTP server.
 o getMessage()
returns the current message.
 o getPort()
returns the current port.
 o getServer()
returns the current server.
 o getSubject()
returns the current subject of the message.
 o getTo()
returns the current recipient of the message.
 o send()
You must use the send() message to actually send the E-mail message.
 o setAdditionalHeaders(String)
sets other headers
 o setFrom(String)
sets who the message is from.
 o setMessage(String)
sets the message to be sent.
 o setServer(String)
sets the SMTP server.
 o setServer(String, int)
sets the SMTP server and port.
 o setSubject(String)
sets the subject.
 o setTimeout(int)
sets the timeout in milliseconds for the socket.
 o setTo(String)
sets who the message is to.

Constructors

 o Email
 public Email()

Methods

 o setServer
 public void setServer(String smtp)
sets the SMTP server.

 o setServer
 public void setServer(String smtp,
                       int port)
sets the SMTP server and port. The default port is 25.

 o setTimeout
 public void setTimeout(int timeout)
sets the timeout in milliseconds for the socket. The default is 60,000 (60 seconds)

 o setFrom
 public void setFrom(String from)
sets who the message is from. This should be a valid E-mail address.

 o setTo
 public void setTo(String to)
sets who the message is to. This should be a valid E-mail address.

 o setSubject
 public void setSubject(String subject)
sets the subject. This may be blank.

 o setMessage
 public void setMessage(String message)
sets the message to be sent.

 o setAdditionalHeaders
 public void setAdditionalHeaders(String otherHeaders)
sets other headers

 o getServer
 public String getServer()
returns the current server.

 o getPort
 public int getPort()
returns the current port.

 o getFrom
 public String getFrom()
returns the current sender of the message.

 o getTo
 public String getTo()
returns the current recipient of the message.

 o getSubject
 public String getSubject()
returns the current subject of the message.

 o getMessage
 public String getMessage()
returns the current message.

 o getLastConversation
 public String getLastConversation()
returns the log of the messages sent to and from the SMTP server.

 o send
 public void send() throws IOException, UnknownHostException
You must use the send() message to actually send the E-mail message. Be sure that the SMTP server has already been set, as well as the to, from, subject, and message of the E-mail.

Throws: IOException
throws IOException if there is an error sending or receiving information from the SMTP server.
Throws: UnknownHostException
throws this exception if the host is unknown.

All Packages  Class Hierarchy  This Package  Previous  Next  Index