feat: SMTP salida propio en webhook de soporte

This commit is contained in:
Lizandro Guarnizo
2026-07-30 12:19:56 -05:00
parent 333fe03de0
commit 03b18418eb
5 changed files with 203 additions and 10 deletions
+70 -1
View File
@@ -49,7 +49,62 @@
<p class="text-xs text-slate-400 mt-1">Los tickets creados por email se asignarán automáticamente a este admin.</p>
</div>
<div class="pt-2">
<!-- ─── SMTP salida ──────────────────────────────────────────── -->
<div class="border-t border-slate-100 pt-4 mt-4">
<p class="text-sm font-semibold text-slate-700 mb-3">SMTP salida (notificaciones y auto-respuesta)</p>
<div class="grid grid-cols-2 gap-3">
<div class="col-span-1">
<label class="block text-xs font-medium text-slate-600 mb-1">Host</label>
<input x-model="cfg.smtp_host" type="text" placeholder="smtp.example.com"
class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
</div>
<div class="col-span-1">
<label class="block text-xs font-medium text-slate-600 mb-1">Puerto</label>
<input x-model="cfg.smtp_port" type="number" placeholder="587"
class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
</div>
</div>
<div class="grid grid-cols-2 gap-3 mt-2">
<div>
<label class="block text-xs font-medium text-slate-600 mb-1">Usuario</label>
<input x-model="cfg.smtp_username" type="text" placeholder="correo@example.com"
class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
</div>
<div>
<label class="block text-xs font-medium text-slate-600 mb-1">Contraseña</label>
<input x-model="cfg.smtp_password" type="password" placeholder="••••••••"
class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
</div>
</div>
<div class="grid grid-cols-2 gap-3 mt-2">
<div>
<label class="block text-xs font-medium text-slate-600 mb-1">Email remitente</label>
<input x-model="cfg.smtp_from_addr" type="text" placeholder="soporte@u-s.app"
class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
</div>
<div>
<label class="block text-xs font-medium text-slate-600 mb-1">Nombre remitente</label>
<input x-model="cfg.smtp_from_name" type="text" placeholder="Soporte U-site"
class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
</div>
</div>
<div class="mt-2">
<label class="block text-xs font-medium text-slate-600 mb-1">Encriptación</label>
<select x-model="cfg.smtp_encryption" class="w-full border border-slate-200 rounded-lg px-3 py-2 text-sm outline-none">
<option value="tls">TLS (puerto 465)</option>
<option value="starttls">STARTTLS (puerto 587)</option>
<option value="none">Sin encriptación</option>
</select>
</div>
<p class="text-xs text-slate-400 mt-2">Si se deja vacío, se usará la configuración SMTP general del sistema.</p>
</div>
<div class="pt-4">
<button @click="guardar()"
class="px-6 py-2 rounded-xl text-white text-sm font-medium transition-colors"
style="background:#8eb02f"
@@ -78,6 +133,13 @@ function soporteWebhook() {
responder_auto: true,
mensaje_auto: '',
asignar_a: '',
smtp_host: '',
smtp_port: 587,
smtp_username: '',
smtp_password: '',
smtp_encryption: 'starttls',
smtp_from_addr: '',
smtp_from_name: '',
},
admins: [],
webhookUrl: '',
@@ -107,6 +169,13 @@ function soporteWebhook() {
responder_auto: this.cfg.responder_auto,
mensaje_auto: this.cfg.mensaje_auto,
asignar_a: this.cfg.asignar_a ? parseInt(this.cfg.asignar_a) : null,
smtp_host: this.cfg.smtp_host || '',
smtp_port: parseInt(this.cfg.smtp_port) || 587,
smtp_username: this.cfg.smtp_username || '',
smtp_password: this.cfg.smtp_password || '',
smtp_encryption: this.cfg.smtp_encryption || 'starttls',
smtp_from_addr: this.cfg.smtp_from_addr || '',
smtp_from_name: this.cfg.smtp_from_name || '',
};
try {
await axios.post('/app/soporte/webhook', payload);