style: pfandlogo.png statt .jpg (transparente Version)
- public/pfandlogo.png ersetzt pfandlogo.jpg - Alle Referenzen umgestellt (Login, TopNav, SuperAdmin, index.html, manifest.json) - favicon type=image/png
This commit is contained in:
@@ -1,20 +1,47 @@
|
||||
import nodemailer from 'nodemailer';
|
||||
import { Resend } from 'resend';
|
||||
|
||||
const resend = process.env.RESEND_API_KEY ? new Resend(process.env.RESEND_API_KEY) : null;
|
||||
const FROM = process.env.MAIL_FROM || 'Pfandsystem Demo <demo@dockly.de>';
|
||||
|
||||
export async function sendDemoInviteMail({ to, name, slug, password, loginUrl, days }) {
|
||||
if (!resend) {
|
||||
console.log('[mail-dev] Demo-Invite an', to, 'Slug:', slug, 'Pw:', password);
|
||||
return { dev: true };
|
||||
let transporter = null;
|
||||
if (process.env.SMTP_HOST && process.env.SMTP_USER && process.env.SMTP_PASS) {
|
||||
transporter = nodemailer.createTransport({
|
||||
host: process.env.SMTP_HOST,
|
||||
port: parseInt(process.env.SMTP_PORT || '587'),
|
||||
secure: (process.env.SMTP_SECURE || 'false') === 'true', // 587 = STARTTLS (secure=false)
|
||||
auth: {
|
||||
user: process.env.SMTP_USER,
|
||||
pass: process.env.SMTP_PASS,
|
||||
},
|
||||
});
|
||||
console.log('[mail] SMTP transport aktiv:', process.env.SMTP_HOST);
|
||||
}
|
||||
|
||||
const resend = process.env.RESEND_API_KEY ? new Resend(process.env.RESEND_API_KEY) : null;
|
||||
|
||||
async function sendMail({ to, subject, html }) {
|
||||
if (transporter) {
|
||||
const info = await transporter.sendMail({ from: FROM, to, subject, html });
|
||||
console.log('[mail] SMTP sent:', to, 'msgId:', info.messageId);
|
||||
return { provider: 'smtp', messageId: info.messageId, accepted: info.accepted, rejected: info.rejected };
|
||||
}
|
||||
if (resend) {
|
||||
const r = await resend.emails.send({ from: FROM, to, subject, html });
|
||||
console.log('[mail] Resend sent:', to, 'id:', r.data?.id);
|
||||
return { provider: 'resend', id: r.data?.id, error: r.error };
|
||||
}
|
||||
console.log('[mail-dev] (kein Provider konfiguriert) ->', to, subject);
|
||||
return { dev: true };
|
||||
}
|
||||
|
||||
export async function sendDemoInviteMail({ to, name, slug, password, loginUrl, days }) {
|
||||
const html = `
|
||||
<div style="font-family:system-ui,Segoe UI,Helvetica,Arial,sans-serif;max-width:560px;margin:auto">
|
||||
<h2 style="color:#1e293b">Willkommen im Pfandsystem-Demo</h2>
|
||||
<h2 style="color:#051e23">Willkommen im Pfandsystem-Demo</h2>
|
||||
<p>Hallo ${name},</p>
|
||||
<p>dein <strong>${days}-Tage Demo-Zugang</strong> ist bereit. Du kannst alle Funktionen
|
||||
in Ruhe testen und eigene Beispieldaten anlegen.</p>
|
||||
<div style="background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;padding:16px;margin:16px 0">
|
||||
<div style="background:#f1f7f8;border:1px solid #b9d2d7;border-radius:8px;padding:16px;margin:16px 0">
|
||||
<p style="margin:4px 0"><strong>Login-URL:</strong> <a href="${loginUrl}">${loginUrl}</a></p>
|
||||
<p style="margin:4px 0"><strong>E-Mail:</strong> ${to}</p>
|
||||
<p style="margin:4px 0"><strong>Passwort:</strong> <code>${password}</code></p>
|
||||
@@ -23,10 +50,18 @@ export async function sendDemoInviteMail({ to, name, slug, password, loginUrl, d
|
||||
<p>Bitte aendere dein Passwort nach dem ersten Login.</p>
|
||||
<p style="color:#64748b;font-size:12px">Diese Mail wurde automatisch versandt vom Pfandsystem-Demo-Portal.</p>
|
||||
</div>`;
|
||||
return resend.emails.send({
|
||||
from: FROM,
|
||||
to,
|
||||
subject: `Dein Pfandsystem-Demo-Zugang (${days} Tage)`,
|
||||
html
|
||||
});
|
||||
return sendMail({ to, subject: `Dein Pfandsystem-Demo-Zugang (${days} Tage)`, html });
|
||||
}
|
||||
|
||||
// Test-Endpoint Helper
|
||||
export async function sendTestMail(to) {
|
||||
const html = `
|
||||
<div style="font-family:system-ui,Segoe UI,Helvetica,Arial,sans-serif;max-width:560px;margin:auto">
|
||||
<h2 style="color:#051e23">Pfandsystem Demo - SMTP-Test</h2>
|
||||
<p>Diese Test-Mail bestaetigt, dass der Mail-Versand ueber
|
||||
<code>${process.env.SMTP_HOST || 'kein SMTP'}</code> funktioniert.</p>
|
||||
<p>Absender: <code>${FROM}</code></p>
|
||||
<p>Zeitstempel: ${new Date().toISOString()}</p>
|
||||
</div>`;
|
||||
return sendMail({ to, subject: 'Pfandsystem Demo - SMTP-Test', html });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user