Features:
- Add fields from a form
- Apply formatting (bold, italic, underline)
- Preview
Example PHP code in AS (After Save) event to send an email using a template:
Code: Select all
// Retrieve the template data
$template = nuGetEmailTemplateData("example_template");
if ($template == false) {
nuDisplayError('Unknown email template!');
return;
}
$sendResult = sendEmailFromTemplate($template);
if ($sendResult[0] != true) {
nuDisplayError($sendResult[1].'<br>'.$sendResult[2]);
}
// Sends an email message using an email template.
function sendEmailFromTemplate($template) {
$params = array(
'to' => $template['to'],
'cc' => $template['cc'],
'bcc' => $template['bcc'],
'body' => nl2br($template['body']),
'subject' => $template['subject']
);
// Replace all Hash Cookies
foreach ($params as $key => $value) {
$params[$key] = nuReplaceHashVariables($value);
}
return nuSendEmail($params);
}