SimpleMailMessage (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

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

  - ### Method Summary

    Methods
    Modifier and Type | Method and 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 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:
        `IllegalArgumentException` - if the supplied message is `null`

  - ### 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
      Throws:
        `IllegalArgumentException` - if the supplied `target` is `null`

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