Spring Framework

org.springframework.mail
Class SimpleMailMessage

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

public class SimpleMailMessage
extends java.lang.Object
implements MailMessage, java.io.Serializable

Models a simple mail message, including data such as the from, to, cc, subject, and text fields.

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

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 for creating a new SimpleMailMessage from the state of an existing SimpleMailMessage instance.
 
Method Summary
 void copyTo(MailMessage target)
          Copy the contents of this message to the given target message.
 boolean equals(java.lang.Object other)
           
 java.lang.String[] getBcc()
           
 java.lang.String[] getCc()
           
 java.lang.String getFrom()
           
 java.lang.String getReplyTo()
           
 java.util.Date getSentDate()
           
 java.lang.String getSubject()
           
 java.lang.String getText()
           
 java.lang.String[] getTo()
           
 int hashCode()
           
 void setBcc(java.lang.String bcc)
           
 void setBcc(java.lang.String[] bcc)
           
 void setCc(java.lang.String cc)
           
 void setCc(java.lang.String[] cc)
           
 void setFrom(java.lang.String from)
           
 void setReplyTo(java.lang.String replyTo)
           
 void setSentDate(java.util.Date sentDate)
           
 void setSubject(java.lang.String subject)
           
 void setText(java.lang.String text)
           
 void setTo(java.lang.String to)
           
 void setTo(java.lang.String[] to)
           
 java.lang.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 for creating a new SimpleMailMessage from the state of an existing SimpleMailMessage instance.

Throws:
java.lang.IllegalArgumentException - if the supplied message is null
Method Detail

setFrom

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

getFrom

public java.lang.String getFrom()

setReplyTo

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

getReplyTo

public java.lang.String getReplyTo()

setTo

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

setTo

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

getTo

public java.lang.String[] getTo()

setCc

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

setCc

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

getCc

public java.lang.String[] getCc()

setBcc

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

setBcc

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

getBcc

public java.lang.String[] getBcc()

setSentDate

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

getSentDate

public java.util.Date getSentDate()

setSubject

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

getSubject

public java.lang.String getSubject()

setText

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

getText

public java.lang.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
Throws:
java.lang.IllegalArgumentException - if the supplied target is null

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

Spring Framework