org.mmbase.util
Class Mail

java.lang.Object
  extended by org.mmbase.util.Mail

public class Mail
extends Object

This mail-object gives persons the functionality to create mail and send it with the SendMail-module.

Version:
$Id: Mail.java 35335 2009-05-21 08:14:41Z michiel $
Author:
Rob Vermeulen
Application:
Mail

Field Summary
 String from
          The sender of the mail
 Hashtable<String,String> headers
          All the mail headers defined for this mail object.
 String text
          The message body text
 String to
          The recipient of the mail
 
Constructor Summary
Mail(String to, String from)
          Create a Mail object.
 
Method Summary
 String getHeader(String header)
          Retrieves the value of a mail header.
 void setBcc(String bcc)
          Sends the message to all persons mentioned in the BCC list.
 void setCc(String cc)
          Sends the message to all persons mentioned in the CC list.
 void setComment(String comment)
          Adds a comment to the mail.
 void setDate()
          Sets the time of the mail
 void setDate(String date)
          Sets given time to the mail
 void setFrom(String from)
          Tells the mail from who the mail is coming.
 String setHeader(String header, String value)
          Sets a mail header to a fixed value
 void setReplyTo(String reply)
          Sets the Reply-to address
 void setSubject(String subject)
          Sets the subject of the mail
 void setText(String text)
          Set the mail message text.
 void setTo(String to)
          Tells the mail for who the mail is.
 String toString()
          Returns a description of the mail object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

headers

public Hashtable<String,String> headers
All the mail headers defined for this mail object.


to

public String to
The recipient of the mail


from

public String from
The sender of the mail


text

public String text
The message body text

Constructor Detail

Mail

public Mail(String to,
            String from)
Create a Mail object. The parameters define recipient and sender, but this does not create any mail headers.

Parameters:
to - the recipient of teh mail
from - teh sender of the mail
Method Detail

setText

public void setText(String text)
Set the mail message text.


setSubject

public void setSubject(String subject)
Sets the subject of the mail


setDate

public void setDate()
Sets the time of the mail


setDate

public void setDate(String date)
Sets given time to the mail


setFrom

public void setFrom(String from)
Tells the mail from who the mail is coming. Does not alter the from field.


setTo

public void setTo(String to)
Tells the mail for who the mail is. Does not alter the to field.


setCc

public void setCc(String cc)
Sends the message to all persons mentioned in the CC list. Recipients of the message can see the names of the other recipients.


setBcc

public void setBcc(String bcc)
Sends the message to all persons mentioned in the BCC list. Recipients of the message cannot see the names of the other recipients.


setComment

public void setComment(String comment)
Adds a comment to the mail.


setReplyTo

public void setReplyTo(String reply)
Sets the Reply-to address


setHeader

public String setHeader(String header,
                        String value)
Sets a mail header to a fixed value

Returns:
the old value of the header (null if not earlier defined)

getHeader

public String getHeader(String header)
Retrieves the value of a mail header.

Returns:
the value of the header (null if not defined)

toString

public String toString()
Returns a description of the mail object. Includes headers and message text.

Overrides:
toString in class Object
Returns:
the mail description


MMBase 2.0-SNAPSHOT - null