public class SimpleMailMessage extends java.lang.Object implements MailMessage, java.io.Serializable
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.
MailSender
,
JavaMailSender
,
MimeMessagePreparator
,
MimeMessageHelper
,
MimeMailMessage
,
Serialized FormModifier and Type | Field and Description |
---|---|
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 |
Constructor and Description |
---|
SimpleMailMessage()
Create a new
SimpleMailMessage . |
SimpleMailMessage(SimpleMailMessage original)
Copy constructor for creating a new
SimpleMailMessage from the state
of an existing SimpleMailMessage instance. |
Modifier and Type | Method and Description |
---|---|
private static java.lang.String[] |
copy(java.lang.String[] state) |
private static java.lang.String[] |
copyOrNull(java.lang.String[] state) |
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() |
@Nullable private java.lang.String from
@Nullable private java.lang.String replyTo
@Nullable private java.lang.String[] to
@Nullable private java.lang.String[] cc
@Nullable private java.lang.String[] bcc
@Nullable private java.util.Date sentDate
@Nullable private java.lang.String subject
@Nullable private java.lang.String text
public SimpleMailMessage()
SimpleMailMessage
.public SimpleMailMessage(SimpleMailMessage original)
SimpleMailMessage
from the state
of an existing SimpleMailMessage
instance.public void setFrom(java.lang.String from)
setFrom
in interface MailMessage
@Nullable public java.lang.String getFrom()
public void setReplyTo(java.lang.String replyTo)
setReplyTo
in interface MailMessage
@Nullable public java.lang.String getReplyTo()
public void setTo(java.lang.String to)
setTo
in interface MailMessage
public void setTo(java.lang.String... to)
setTo
in interface MailMessage
@Nullable public java.lang.String[] getTo()
public void setCc(java.lang.String cc)
setCc
in interface MailMessage
public void setCc(java.lang.String... cc)
setCc
in interface MailMessage
@Nullable public java.lang.String[] getCc()
public void setBcc(java.lang.String bcc)
setBcc
in interface MailMessage
public void setBcc(java.lang.String... bcc)
setBcc
in interface MailMessage
@Nullable public java.lang.String[] getBcc()
public void setSentDate(java.util.Date sentDate)
setSentDate
in interface MailMessage
@Nullable public java.util.Date getSentDate()
public void setSubject(java.lang.String subject)
setSubject
in interface MailMessage
@Nullable public java.lang.String getSubject()
public void setText(java.lang.String text)
setText
in interface MailMessage
@Nullable public java.lang.String getText()
public void copyTo(MailMessage target)
target
- the MailMessage
to copy topublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
@Nullable private static java.lang.String[] copyOrNull(@Nullable java.lang.String[] state)
private static java.lang.String[] copy(java.lang.String[] state)