com.mentata.sg8
Class SG8Email

java.lang.Object
  extended bycom.mentata.sg8.SG8Email

public class SG8Email
extends Object

A utility class for sending email messages.

Since:
0.7
Author:
Jon Roberts

Constructor Summary
SG8Email(String from)
          Constructs a new email message to send via localhost.
SG8Email(String from, String host)
          Constructs a new email message.
 
Method Summary
 void deliver()
          Delivers the message and then closes the mail server connection.
 PrintStream getBodyStream()
          Returns a stream for writing the message body.
 void setSubject(String subject)
          Set the email subject header.
 void setTo(String[] to)
          Set the email to addresses and header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SG8Email

public SG8Email(String from)
         throws SG8Exception
Constructs a new email message to send via localhost.

Parameters:
from - a sender email address
Throws:
SG8Exception - if the mail server does not respond

SG8Email

public SG8Email(String from,
                String host)
         throws SG8Exception
Constructs a new email message.

Parameters:
from - a sender email address
host - a mail server
Throws:
SG8Exception - if the mail server does not respond
Method Detail

setTo

public void setTo(String[] to)
           throws SG8Exception
Set the email to addresses and header.

Throws:
SG8Exception - if the mail server does not accept the to addresses

setSubject

public void setSubject(String subject)
Set the email subject header.


getBodyStream

public PrintStream getBodyStream()
                          throws SG8Exception
Returns a stream for writing the message body.

Throws:
SG8Exception - if the mail server reports a problem

deliver

public void deliver()
             throws SG8Exception
Delivers the message and then closes the mail server connection.

Throws:
SG8Exception - if the mail server reports a problem