Package org.springframework.mail

# Class SimpleMailMessage

java.lang.Object
org.springframework.mail.SimpleMailMessage

All Implemented Interfaces:
  `Serializable`, `MailMessage`

public class SimpleMailMessage extends Object implements MailMessage, 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

Constructors
Constructor
Description
`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

Modifier and Type
Method
Description
`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 Details

### 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.

## Method Details

### setFrom

public void setFrom(@Nullable String from)

Specified by:
  `setFrom` in interface `MailMessage`

### getFrom

@Nullable public String getFrom()

### setReplyTo

public void setReplyTo(@Nullable String replyTo)

Specified by:
  `setReplyTo` in interface `MailMessage`

### getReplyTo

@Nullable public String getReplyTo()

### setTo

public void setTo(@Nullable String to)

Specified by:
  `setTo` in interface `MailMessage`

### setTo

public void setTo(String... to)

Specified by:
  `setTo` in interface `MailMessage`

### getTo

@Nullable public String[] getTo()

### setCc

public void setCc(@Nullable String cc)

Specified by:
  `setCc` in interface `MailMessage`

### setCc

public void setCc(@Nullable String... cc)

Specified by:
  `setCc` in interface `MailMessage`

### getCc

@Nullable public String[] getCc()

### setBcc

public void setBcc(@Nullable String bcc)

Specified by:
  `setBcc` in interface `MailMessage`

### setBcc

public void setBcc(@Nullable String... bcc)

Specified by:
  `setBcc` in interface `MailMessage`

### getBcc

@Nullable public String[] getBcc()

### setSentDate

public void setSentDate(@Nullable Date sentDate)

Specified by:
  `setSentDate` in interface `MailMessage`

### getSentDate

@Nullable public Date getSentDate()

### setSubject

public void setSubject(@Nullable String subject)

Specified by:
  `setSubject` in interface `MailMessage`

### getSubject

@Nullable public String getSubject()

### setText

public void setText(@Nullable String text)

Specified by:
  `setText` in interface `MailMessage`

### getText

@Nullable 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

### equals

public boolean equals(@Nullable Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### toString

public String toString()

Overrides:
  `toString` in class `Object`