Please add this to the PHP file.
$giftcods = ['code1' => 'VFDFRVXSW43VF'['VFDFRVXSW43VF', 'code2' => 'FFRFRFVSW43VF', 'code3' => 'VFDFGFGFXSW43VF']; $templateVars = new \Magento\Framework\DataObject(); $templateVars->setData([ 'store' => $this->storeManager->getStore(), 'customer_name' => $name, 'giftcods' => implode("<br>",$giftcods) ]);]; And set in template as ->setTemplateVars(['templateVars' => $templateVars]$templateVars)
Use variable in HTML as,
<div style="color:#696969;font-size:20px;text-align:center;"> <strong>{{var templateVars.giftcods|raw}}</strong> </div> Clear cache: php bin/magento cache:clean and check it.