com.strangelight.util
Class Email

java.lang.Object
  |
  +--com.strangelight.util.Email

public class Email
extends java.lang.Object

A class for creating and sending simple emails.


Constructor Summary
Email()
          Creates a new, empty (no sender, no recipient, no subject, no body) email.
 
Method Summary
 java.lang.String send()
          Send this email.
 void setBody(java.lang.String s)
          Sets the body of this email.
 void setFrom(java.lang.String s)
          Specifies the email address of the sender of this email (i.e.
 void setFromRealname(java.lang.String s)
          Specifies the "Real Name" of the sender of this email.
 void setSubject(java.lang.String s)
          Sets the subject of this email (i.e. the Subject: field of the email header).
 void setTo(java.lang.String s)
          Specifies the email address of the recipient of this email (i.e.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Email

public Email()
Creates a new, empty (no sender, no recipient, no subject, no body) email.

Method Detail

send

public java.lang.String send()
Send this email.

Throws:
java.lang.IllegalStateException - if the sender and/or recipient have not yet been set (using setFrom(String) and setTo(String)).

setTo

public void setTo(java.lang.String s)
Specifies the email address of the recipient of this email (i.e. the To: field of the email header).

Parameters:
s - the email address to send to (e.g. "info@strangelight.com" ).

setFrom

public void setFrom(java.lang.String s)
Specifies the email address of the sender of this email (i.e. the From: field of the email header).

Parameters:
s - the email address to send from (e.g. "foo@nospam.com" ).

setFromRealname

public void setFromRealname(java.lang.String s)
Specifies the "Real Name" of the sender of this email.

Parameters:
s - the email address to send from (e.g. "webmaster" ).

setSubject

public void setSubject(java.lang.String s)
Sets the subject of this email (i.e. the Subject: field of the email header).

Parameters:
s - the subject of this email.

setBody

public void setBody(java.lang.String s)
Sets the body of this email.

Parameters:
s - the body of this email.