Compare commits
No commits in common. "d9d82d8e7be45e5884f0f58248280c262bcab389" and "1cf300455218b7d5b4e2ca5a0f5d1e10d02f1ac1" have entirely different histories.
d9d82d8e7b
...
1cf3004552
|
|
@ -1,15 +1,6 @@
|
||||||
import nodemailer from "nodemailer";
|
import nodemailer from "nodemailer";
|
||||||
import { queueEmail } from "./email-queue";
|
import { queueEmail } from "./email-queue";
|
||||||
|
|
||||||
function escapeHtml(value: string): string {
|
|
||||||
return value
|
|
||||||
.replace(/&/g, "&")
|
|
||||||
.replace(/</g, "<")
|
|
||||||
.replace(/>/g, ">")
|
|
||||||
.replace(/"/g, """)
|
|
||||||
.replace(/'/g, "'");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Port 587 = STARTTLS, Port 465 = SSL/TLS
|
// Port 587 = STARTTLS, Port 465 = SSL/TLS
|
||||||
const transporter = nodemailer.createTransport({
|
const transporter = nodemailer.createTransport({
|
||||||
host: process.env.SMTP_HOST,
|
host: process.env.SMTP_HOST,
|
||||||
|
|
@ -218,86 +209,3 @@ export async function sendeKontaktEmail(
|
||||||
`Kontaktanfrage ${data.name}`
|
`Kontaktanfrage ${data.name}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sendeFlyerBenachrichtigung(
|
|
||||||
data: { email: string }
|
|
||||||
): Promise<{ sent: boolean; queued: boolean }> {
|
|
||||||
const html = `
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head><meta charset="UTF-8"></head>
|
|
||||||
<body style="font-family:system-ui,sans-serif;color:#e2e8f0;max-width:600px;margin:0 auto;padding:0">
|
|
||||||
<div style="background:#18212f;padding:20px 24px;border-bottom:2px solid #f97316">
|
|
||||||
<h1 style="color:#f97316;margin:0;font-size:20px;font-weight:700">MBO Tech IT</h1>
|
|
||||||
<p style="color:rgba(255,255,255,0.6);margin:4px 0 0;font-size:13px">FamilyGuard Flyer-Download</p>
|
|
||||||
</div>
|
|
||||||
<div style="padding:24px;background:#1e2a3b">
|
|
||||||
<h2 style="margin:0 0 16px;font-size:18px;color:#f8fafc">Neuer Flyer-Download</h2>
|
|
||||||
<p style="color:#94a3b8;margin:0 0 16px;line-height:1.6">
|
|
||||||
Ein Interessent hat den MBO FamilyGuard Flyer angefordert.
|
|
||||||
</p>
|
|
||||||
<table style="width:100%;border-collapse:collapse">
|
|
||||||
<tr><td style="padding:6px 0;color:#94a3b8;width:120px">E-Mail</td><td style="padding:6px 0"><a href="mailto:${escapeHtml(data.email)}" style="color:#60a5fa">${escapeHtml(data.email)}</a></td></tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
<div style="padding:12px 24px;background:#111925;border-top:1px solid rgba(255,255,255,0.1)">
|
|
||||||
<p style="margin:0;font-size:11px;color:#64748b">MBO Tech IT · ${process.env.APP_URL ?? "https://mbo-tech-it.de"}</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>`;
|
|
||||||
|
|
||||||
return sendWithFallback(
|
|
||||||
{
|
|
||||||
from: `"MBO Tech IT" <${process.env.SMTP_FROM}>`,
|
|
||||||
to: "jonny@mbo-tech-it.de",
|
|
||||||
replyTo: data.email,
|
|
||||||
subject: `Neuer FamilyGuard-Flyer-Download: ${data.email}`,
|
|
||||||
text: `Neuer Flyer-Download\n\nE-Mail: ${data.email}`,
|
|
||||||
html,
|
|
||||||
},
|
|
||||||
`FamilyGuard-Flyer-Benachrichtigung ${data.email}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sendeFlyerLink(data: { email: string }): Promise<void> {
|
|
||||||
const downloadLink = `${process.env.APP_URL ?? "https://mbo-tech-it.de"}/downloads/MBO_FamilyGuard_Flyer_01.pdf`;
|
|
||||||
const html = `
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="de">
|
|
||||||
<head><meta charset="UTF-8"></head>
|
|
||||||
<body style="font-family:system-ui,sans-serif;color:#e2e8f0;max-width:600px;margin:0 auto;padding:0">
|
|
||||||
<div style="background:#18212f;padding:20px 24px;border-bottom:2px solid #f97316">
|
|
||||||
<h1 style="color:#f97316;margin:0;font-size:20px;font-weight:700">MBO Tech IT</h1>
|
|
||||||
<p style="color:rgba(255,255,255,0.6);margin:4px 0 0;font-size:13px">MBO FamilyGuard</p>
|
|
||||||
</div>
|
|
||||||
<div style="padding:24px;background:#1e2a3b">
|
|
||||||
<h2 style="margin:0 0 16px;font-size:18px;color:#f8fafc">Ihr FamilyGuard-Flyer</h2>
|
|
||||||
<p style="color:#94a3b8;margin:0 0 24px;line-height:1.6">
|
|
||||||
Vielen Dank für Ihr Interesse an MBO FamilyGuard. Den Flyer mit allen Details
|
|
||||||
finden Sie hier zum Download:
|
|
||||||
</p>
|
|
||||||
<a href="${downloadLink}"
|
|
||||||
style="display:inline-block;background:#f97316;color:#fff;font-weight:700;padding:12px 24px;border-radius:8px;text-decoration:none;font-size:15px">
|
|
||||||
Flyer herunterladen
|
|
||||||
</a>
|
|
||||||
<p style="color:#64748b;font-size:12px;margin:24px 0 0">
|
|
||||||
Fragen? Rufen Sie uns an: <a href="tel:+4917193451093" style="color:#f97316">+49 171 9345193</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<div style="padding:12px 24px;background:#111925;border-top:1px solid rgba(255,255,255,0.1)">
|
|
||||||
<p style="margin:0;font-size:11px;color:#64748b">MBO Tech IT · ${process.env.APP_URL ?? "https://mbo-tech-it.de"}</p>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>`;
|
|
||||||
|
|
||||||
await sendWithFallback(
|
|
||||||
{
|
|
||||||
from: `"MBO Tech IT" <${process.env.SMTP_FROM}>`,
|
|
||||||
to: data.email,
|
|
||||||
subject: "Ihr MBO FamilyGuard Flyer",
|
|
||||||
text: `Hallo,\n\nvielen Dank für Ihr Interesse an MBO FamilyGuard. Den Flyer finden Sie hier:\n${downloadLink}\n\nMBO Tech IT`,
|
|
||||||
html,
|
|
||||||
},
|
|
||||||
`FamilyGuard-Flyer-Link ${data.email}`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -431,28 +431,6 @@ export interface Database {
|
||||||
};
|
};
|
||||||
Relationships: [];
|
Relationships: [];
|
||||||
};
|
};
|
||||||
flyer_downloads: {
|
|
||||||
Row: {
|
|
||||||
id: number;
|
|
||||||
email: string;
|
|
||||||
flyer: string;
|
|
||||||
dsgvo_einwilligung: boolean;
|
|
||||||
created_at: string;
|
|
||||||
};
|
|
||||||
Insert: {
|
|
||||||
id?: number;
|
|
||||||
email: string;
|
|
||||||
flyer?: string;
|
|
||||||
dsgvo_einwilligung: boolean;
|
|
||||||
created_at?: string;
|
|
||||||
};
|
|
||||||
Update: {
|
|
||||||
email?: string;
|
|
||||||
flyer?: string;
|
|
||||||
dsgvo_einwilligung?: boolean;
|
|
||||||
};
|
|
||||||
Relationships: [];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
Views: Record<string, never>;
|
Views: Record<string, never>;
|
||||||
Functions: Record<string, never>;
|
Functions: Record<string, never>;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue