The Spring Framework

org.springframework.mail
Class SimpleMailMessage

java.lang.Object
  extended by org.springframework.mail.SimpleMailMessage
All Implemented Interfaces:
Serializable, MailMessage

public class SimpleMailMessage
extends Object
implements MailMessage, Serializable

Encapsulates properties of a simple mail such as from, to, cc, subject, text. To be sent with a MailSender implementation.

Consider JavaMailSender and JavaMail MimeMessages for creating more sophisticated messages, for example with attachments, special character encodings, or personal names that accompany mail addresses.

This simple message class implements the MailMessage interface, to let message population code interact with a simple message or a MIME message through a common interface.

Since:
10.09.2003
Author:
Dmitriy Kopylenko, Juergen Hoeller
See Also:
MailSender, JavaMailSender, MimeMessagePreparator, MimeMessageHelper, MimeMailMessage, Serialized Form

Constructor Summary
SimpleMailMessage()
          Create a new SimpleMailMessage.
SimpleMailMessage(SimpleMailMessage original)
          Copy constructor.
 
Method Summary
 void copyTo(MailMessage target)
          Copy the contents of this message to the given target message.
 boolean equals(Object other)
           
 String[] getBcc()
           
 String[] getCc()
           
 String getFrom()
           
 String getReplyTo()
           
 Date getSentDate()
           
 String getSubject()
           
 String getText()
           
 String[] getTo()
           
 int hashCode()
           
 void setBcc(String bcc)
           
 void setBcc(String[] bcc)
           
 void setCc(String cc)
           
 void setCc(String[] cc)
           
 void setFrom(String from)
           
 void setReplyTo(String replyTo)
           
 void setSentDate(Date sentDate)
           
 void setSubject(String subject)
           
 void setText(String text)
           
 void setTo(String to)
           
 void setTo(String[] to)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleMailMessage

public SimpleMailMessage()
Create a new SimpleMailMessage.


SimpleMailMessage

public SimpleMailMessage(SimpleMailMessage original)
Copy constructor.

Method Detail

setFrom

public void setFrom(String from)
Specified by:
setFrom in interface MailMessage

getFrom

public String getFrom()

setReplyTo

public void setReplyTo(String replyTo)
Specified by:
setReplyTo in interface MailMessage

getReplyTo

public String getReplyTo()

setTo

public void setTo(String to)
Specified by:
setTo in interface MailMessage

setTo

public void setTo(String[] to)
Specified by:
setTo in interface MailMessage

getTo

public String[] getTo()

setCc

public void setCc(String cc)
Specified by:
setCc in interface MailMessage

setCc

public void setCc(String[] cc)
Specified by:
setCc in interface MailMessage

getCc

public String[] getCc()

setBcc

public void setBcc(String bcc)
Specified by:
setBcc in interface MailMessage

setBcc

public void setBcc(String[] bcc)
Specified by:
setBcc in interface MailMessage

getBcc

public String[] getBcc()

setSentDate

public void setSentDate(Date sentDate)
Specified by:
setSentDate in interface MailMessage

getSentDate

public Date getSentDate()

setSubject

public void setSubject(String subject)
Specified by:
setSubject in interface MailMessage

getSubject

public String getSubject()

setText

public void setText(String text)
Specified by:
setText in interface MailMessage

getText

public String getText()

copyTo

public void copyTo(MailMessage target)
Copy the contents of this message to the given target message.

Parameters:
target - the MailMessage to copy to

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

The Spring Framework

Copyright © 2002-2006 The Spring Framework.