---
title: "setMessageBody(_:isHTML:)"
framework: Message UI
role: symbol
role_heading: Instance Method
platforms: [iOS 3.0+, iPadOS 3.0+, Mac Catalyst 13.1+, visionOS 1.0+]
path: "messageui/mfmailcomposeviewcontroller/setmessagebody(_:ishtml:)"
---

# setMessageBody(_:isHTML:)

Sets the initial body text to include in the email.

## Declaration

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

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:) method. Only call this method before you display the mail composition interface. Don’t call it after presenting the interface to the user.

## See Also

### Setting mail fields programmatically

- [setSubject(_:)](messageui/mfmailcomposeviewcontroller/setsubject(_:).md)
- [setToRecipients(_:)](messageui/mfmailcomposeviewcontroller/settorecipients(_:).md)
- [setCcRecipients(_:)](messageui/mfmailcomposeviewcontroller/setccrecipients(_:).md)
- [setBccRecipients(_:)](messageui/mfmailcomposeviewcontroller/setbccrecipients(_:).md)
- [addAttachmentData(_:mimeType:fileName:)](messageui/mfmailcomposeviewcontroller/addattachmentdata(_:mimetype:filename:).md)
- [setPreferredSendingEmailAddress(_:)](messageui/mfmailcomposeviewcontroller/setpreferredsendingemailaddress(_:).md)
