mirror of
https://git.imnavajas.es/jjimenez/safekat.git
synced 2025-07-25 22:52:08 +00:00
Eliminados ajustes de sistemas. Ahora estan en variables del ERP
This commit is contained in:
@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Services;
|
||||
|
||||
use App\Models\Sistema\SettingsModel;
|
||||
use Config\Services;
|
||||
|
||||
class EmailService
|
||||
@ -17,10 +16,8 @@ class EmailService
|
||||
$recipient = 'imnavajas@coit.es'; // <-- Cambia por el correo de pruebas
|
||||
}
|
||||
|
||||
|
||||
$settings_model = new SettingsModel();
|
||||
$config = $settings_model->first()->toArray();
|
||||
$gateway = $config['email_gateway'];
|
||||
$settings_model = model('App\Models\Configuracion\ConfigVariableModel');
|
||||
$gateway = $settings_model->getVariable('email_protocol')->value;
|
||||
$body = html_entity_decode($body);
|
||||
|
||||
if ($gateway === 'smtp') {
|
||||
@ -28,12 +25,12 @@ class EmailService
|
||||
$email = Services::email();
|
||||
|
||||
$emailConfig = [
|
||||
'protocol' => $config['email_gateway'],
|
||||
'SMTPHost' => $config['email_smtp'],
|
||||
'SMTPUser' => $config['email_address'],
|
||||
'SMTPPass' => $config['email_pass'],
|
||||
'SMTPPort' => (int) $config['email_port'],
|
||||
'SMTPCrypto' => $config['email_cert'] === 'none' ? '' : $config['email_cert'],
|
||||
'protocol' => $gateway,
|
||||
'SMTPHost' => $settings_model->getVariable('email_host')->value,
|
||||
'SMTPUser' => $settings_model->getVariable('email_from_address')->value,
|
||||
'SMTPPass' => $settings_model->getVariable('email_pass')->value,
|
||||
'SMTPPort' => (int) $settings_model->getVariable('email_port')->value,
|
||||
'SMTPCrypto' => $settings_model->getVariable('email_cert')->value === 'none' ? '' : $settings_model->getVariable('email_cert')->value,
|
||||
'SMTPTimeout' => 15,
|
||||
'mailType' => 'html',
|
||||
'wordWrap' => true,
|
||||
@ -41,7 +38,7 @@ class EmailService
|
||||
|
||||
$email->initialize($emailConfig);
|
||||
|
||||
$email->setFrom($config['email_address'], $config['email_name']);
|
||||
$email->setFrom($settings_model->getVariable('email_from_address')->value, $settings_model->getVariable('email_from_name')->value);
|
||||
$email->setTo($recipient);
|
||||
$email->setSubject($subject);
|
||||
$email->setMessage($body);
|
||||
|
||||
Reference in New Issue
Block a user