Hello,
Im new to oxid and need to add email functionality to my module.
The module basically gets some stats from database and sends them in a report to a staff member’s email set in module settings through admin panel.
I have everything set up apart from the template and email.
Would love some clarification from those experienced in oxid.
My questions are:
[ul]
[li]Is this how I get the mailer object?
[/li]
$this->mailer = oxNew('oxemail');
[li]How do I get the smarty object?
[/li]
$smarty = ?
[li]Is this how I attach a template to this email?
[/li]
public function getBody(){
if (true === $plain) {
$body = $smarty->fetch($this->templateDir . '/plain/report_plain.tpl');
} else {
$body = $smarty->fetch($this->templateDir . '/html/report.tpl');
}
return $body;
}
(...)
$this->mailer->setBody($this->getBody)
[li]How do I pass my data to the template?
[/li]Smth like that?
$this->mailer->setViewData(smarty_var_name', $varData);
Or?
$smarty->assign('smarty_var_name', $varData);
[li]How do I access them in the template?
[/li][/ul]
Thank you,
Greg