org.mmbase.util
Class Mail

java.lang.Object
  |
  +--org.mmbase.util.Mail

public class Mail
extends java.lang.Object

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

Version:
31 December 1996
Author:
Rob Vermeulen

Field Summary
 java.lang.String from
          The sender of the mail
 java.util.Hashtable headers
          All the mail headers defined for this mail object.
 java.lang.String text
          The message body text
 java.lang.String to
          The recipient of the mail
 
Constructor Summary
Mail(java.lang.String to, java.lang.String from)
          Create a Mail object.
 
Method Summary
 java.lang.String getHeader(java.lang.String header)
          Retrieves the value of a mail header.
 void setBcc(java.lang.String bcc)
          Sends the message to all persons mentioned in the BCC list.
 void setCc(java.lang.String cc)
          Sends the message to all persons mentioned in the CC list.
 void setComment(java.lang.String comment)
          Adds a comment to the mail.
 void setDate()
          Sets the time of the mail
 void setDate(java.lang.String date)
          Sets given time to the mail
 void setFrom(java.lang.String from)
          Tells the mail from who the mail is coming.
 java.lang.String setHeader(java.lang.String header, java.lang.String value)
          Sets a mail header to a fixed value
 void setReplyTo(java.lang.String reply)
          Sets the Reply-to address
 void setSubject(java.lang.String subject)
          Sets the subject of the mail
 void setText(java.lang.String text)
          Set the mail message text.
 void setTo(java.lang.String to)
          Tells the mail for who the mail is.
 java.lang.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 java.util.Hashtable headers
All the mail headers defined for this mail object.

to

public java.lang.String to
The recipient of the mail

from

public java.lang.String from
The sender of the mail

text

public java.lang.String text
The message body text
Constructor Detail

Mail

public Mail(java.lang.String to,
            java.lang.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(java.lang.String text)
Set the mail message text.

setSubject

public void setSubject(java.lang.String subject)
Sets the subject of the mail

setDate

public void setDate()
Sets the time of the mail

setDate

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

setFrom

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

setTo

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

setCc

public void setCc(java.lang.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(java.lang.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(java.lang.String comment)
Adds a comment to the mail.

setReplyTo

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

setHeader

public java.lang.String setHeader(java.lang.String header,
                                  java.lang.String value)
Sets a mail header to a fixed value
Returns:
the old value of the header (null if not earlier defined)

getHeader

public java.lang.String getHeader(java.lang.String header)
Retrieves the value of a mail header.
Returns:
the value of the header (null if not defined)

toString

public java.lang.String toString()
Returns a description of the mail object. Includes headers and message text.
Overrides:
toString in class java.lang.Object
Returns:
the mail description


MMBase 2001