$counter = 0;
foreach ($emails as $email) { $user =
$this->
getMailingUserByEmail($email);
$template->
assign('sUser',
$user, true
);
$hash =
$this->
createHash((int) $user['mailaddressID'
],
(int) $mailing['id'
]);
$template->
assign('sCampaignHash',
$hash, true
);
$template->
assign('sRecommendations',
$this->
getMailingSuggest($mailing['id'
],
$user['userID'
]), true
);
/** @var array $voucher */
$voucher =
$template->
getTemplateVars('sVoucher'
);
if (!
empty($voucher['id'
])) { $voucher['code'
] =
$this->
getVoucherCode($voucher['id'
]);
$template->
assign('sVoucher',
$voucher, true
);
} if (empty($mailing['plaintext'
])) { $body =
$template->
fetch('newsletter/index/' .
$mailing['template'
],
$template);
} $bodyText =
$template->
fetch('newsletter/alt/' .
$mailing['template'
],
$template);
if (!
empty($body)) { $body =
$this->
trackFilter($body,
$mailing['id'
]);
$mail->
setBodyHtml($body);
}