$message = (new Swift_Message('Subject')) ->setFrom(['sender@example.com' => 'Sender Name']) ->setTo(['recipient@example.com']) ->setSender('sender@example.com');
$message = (new Swift_Message('Subject')) ->setFrom(['sender@example.com' => 'Sender Name']) ->setTo(['recipient@example.com']) ->setSender('sender@example.com') ->setBody('This is the message body', 'text/plain');In this example, we set the text body of the email using the setBody function. We also specify the content type as plain text using the second parameter of the function. The setSender function is part of the Swift_Message package library.