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 endforeach; ?>
<?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>'?>