How to send database output in views into email?

i can send normal email using the following code
$clients = Users::find()
->select(‘email’)
->all();

foreach( $clients as $client)

{
Yii::$app->mailer->compose()
->setTo($client->email)

        ->setFrom([$this->email => $this->name])
        ->setSubject($this->subject)
       
      
       ->setHtmlBody($this->body)
        ->send();
}

return 1;

}

but i need to replace body part with outputs from database that is in view
page.
my index.php page looks like this:

                          //$tenderlist is declared in the controller file            
<?php foreach ($tenderlist as $post): ?>
<?=html::encode($post['bidtitle'])?>
 <?php echo ' <table style="margin-left;300px"><tr><td class="collapsing"> '?>Bid Type: <?= html::encode($post['bidtype']) ?> <?php echo '</td></tr>'?> 
<?php echo '<tr><td class="collapsing">'?>Bid Closing date: <?=html::encode($post['etclosingdate'])?> <?php echo '</td></tr>'?>
 <?php echo '<tr><td class="collapsing">'?>Bid Opening date: <?= html::decode($post['etopeningdate']) ?> <?php echo '</td></tr>'?>
<?php endforeach; ?>
this out put displays in table row format. now i want to send these lists into the mail body part, how i can i modify this ->setHtmlBody($this->body) , to attach the html output data from database in to the mail body? thanks

Try This

$email_body = $this->renderPartial(‘index’);

 Yii::$app->mailer->compose()
        ->setTo($client->email)
        ->setFrom([$this->email => $this->name])
        ->setSubject($this->subject)
        ->setHtmlBody($email_body)
        ->send();