$message = new Swift_Message('Subject'); $message->setBody('Hello, world!
', 'text/html'); $htmlBody = $message->getBody(); echo $htmlBody;
$message = new Swift_Message('Subject'); $message->setBody('Hello, world!', 'text/plain'); $plainTextBody = $message->getBody(); echo $plainTextBody;In this example, we create a new message object and set its body with a plain text content. We then use the getBody() method to retrieve the plain text content. In both examples, we use the getBody() method to retrieve the content of the message body. The package library used is the SwiftMailer library.