<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MessageUI",
  "identifier" : "/documentation/MessageUI/MFMailComposeViewController/setMessageBody(_:isHTML:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Message UI"
    ],
    "preciseIdentifier" : "c:objc(cs)MFMailComposeViewController(im)setMessageBody:isHTML:"
  },
  "title" : "setMessageBody(_:isHTML:)"
}
-->

# setMessageBody(_:isHTML:)

Sets the initial body text to include in the email.

```
func setMessageBody(_ body: String, isHTML: Bool)
```

## Parameters

`body`

The initial body text of the message. The text is interpreted as either plain text or HTML, depending on the value of the `isHTML` parameter.

`isHTML`

Specify <doc://com.apple.documentation/documentation/Swift/true> if the body parameter contains HTML content or specify <doc://com.apple.documentation/documentation/Swift/false> if it contains plain text.

## Discussion

This method replaces the previous body content with the new content. If the user has a signature file, the body content is inserted immediately before the signature. If you want to include images with your content, you must attach the images separately using the [`addAttachmentData(_:mimeType:fileName:)`](/documentation/MessageUI/MFMailComposeViewController/addAttachmentData(_:mimeType:fileName:)) method.

Only call this method before you display the mail composition interface. Don’t call it after presenting the interface to the user.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)