. */ use Modules\Emails\Template; include_once __DIR__.'/core.php'; $template = Template::find(get('id')); $module = $template->module; $smtp = $template->account; $body = $module->replacePlaceholders($id_record, $template['body']); $subject = $module->replacePlaceholders($id_record, $template['subject']); $emails = []; if ($module->replacePlaceholders($id_record, '{email}')) { $emails = explode(';', $module->replacePlaceholders($id_record, '{email}')); } $id_anagrafica = $module->replacePlaceholders($id_record, '{id_anagrafica}'); // Aggiungo email referenti in base alla mansione impostata nel template $mansioni = $dbo->select('em_mansioni_template', 'idmansione', ['id_template' => $template->id]); foreach ($mansioni as $mansione) { $referenti = $dbo->table('an_referenti')->where('idmansione', $mansione['idmansione'])->where('idanagrafica', $id_anagrafica)->where('email', '!=', '')->get(); foreach ($referenti as $referente) { if (!in_array($referente->email, $emails)) { $emails[] = $referente->email; } } } // Campi mancanti $campi_mancanti = []; if (empty($smtp['from_address'])) { $campi_mancanti[] = tr('Mittente'); } if (empty($smtp['server'])) { $campi_mancanti[] = tr('Server SMTP'); } if (empty($smtp['port'])) { $campi_mancanti[] = tr('Porta'); } if (sizeof($campi_mancanti) > 0) { echo '