org.springframework.mail
Class SimpleMailMessage
java.lang.Object
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
Field Summary |
private java.lang.String[] |
bcc
|
private java.lang.String[] |
cc
|
private java.lang.String |
from
|
private java.lang.String |
replyTo
|
private java.util.Date |
sentDate
|
private java.lang.String |
subject
|
private java.lang.String |
text
|
private java.lang.String[] |
to
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
from
private java.lang.String from
replyTo
private java.lang.String replyTo
to
private java.lang.String[] to
cc
private java.lang.String[] cc
bcc
private java.lang.String[] bcc
sentDate
private java.util.Date sentDate
subject
private java.lang.String subject
text
private java.lang.String text
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
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
copy
private static java.lang.String[] copy(java.lang.String[] state)