This commit is contained in:
2026-02-24 01:24:34 +01:00
parent 66d29ff6c4
commit 6a8d5720c5

View File

@@ -926,6 +926,7 @@ function renderSmtpProfileList() {
<td>${escapeHtml(user)}</td>
<td>${escapeHtml(sender)}</td>
<td class="text-right">
<button class="btn" data-smtp-action="test" data-smtp-id="${profile.id}">Test</button>
<button class="btn" data-smtp-action="edit" data-smtp-id="${profile.id}">Bearbeiten</button>
<button class="btn" data-smtp-action="copy" data-smtp-id="${profile.id}">Kopieren</button>
<button class="btn btn-danger" data-smtp-action="delete" data-smtp-id="${profile.id}">Löschen</button>
@@ -943,6 +944,8 @@ function handleSmtpProfileTableClick(ev) {
if (!profile) return;
if (action === 'edit') {
openSmtpProfileForm(profile);
} else if (action === 'test') {
runSmtpProfileTest(profile.id);
} else if (action === 'copy') {
if (confirm(`Versandprofil "${profile.label || profile.smtp_host}" kopieren?`)) {
copySmtpProfile(id);
@@ -1031,6 +1034,18 @@ async function copySmtpProfile(profileId) {
}
}
async function runSmtpProfileTest(profileId) {
const recipient = prompt('Test-E-Mail an welche Adresse senden?', window.__currentUser?.email || '');
if (!recipient) return;
try {
const res = await apiAction('account.smtp.test', { method: 'POST', data: { to: recipient.trim(), smtp_profile_id: profileId } });
if (!res?.ok) throw new Error(res?.error || 'SMTP Test fehlgeschlagen');
toast('SMTP Test gesendet', true);
} catch (err) {
toast(err.message || 'SMTP Test fehlgeschlagen', false);
}
}
function escapeHtml(str) {
return String(str || '')
.replace(/&/g, '&amp;')