Update subscription confirmation email template

This commit is contained in:
mplorentz 2026-08-27 10:17:06 -04:00
parent 0eaf2a9895
commit 082b442f16

View file

@ -29,12 +29,13 @@ const transporter = nodemailer.createTransport({
export const sendConfirm = (sub: Subscription) => { export const sendConfirm = (sub: Subscription) => {
const href = `${BASE_URL}/confirm?token=${sub.key}` const href = `${BASE_URL}/confirm?token=${sub.key}`
const settingsUrl = `${EVENT_VIEWER_URL.replace(/\/$/, '')}/settings/alerts`
return transporter return transporter
.sendMail({ .sendMail({
from: SMTP_FROM, from: SMTP_FROM,
to: sub.email, to: sub.email,
subject: `Confirm your ${BRAND_NAME} digest`, subject: `Confirm your email for ${BRAND_NAME} notifications`,
html: ` html: `
<table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f0f2f5;padding:32px 16px;font-family:Inter,Helvetica,Arial,sans-serif;"> <table role="presentation" width="100%" cellspacing="0" cellpadding="0" style="background:#f0f2f5;padding:32px 16px;font-family:Inter,Helvetica,Arial,sans-serif;">
<tr> <tr>
@ -42,18 +43,17 @@ export const sendConfirm = (sub: Subscription) => {
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width:480px;background:#ffffff;border-radius:12px;overflow:hidden;border:1px solid #e2e8f0;"> <table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="max-width:480px;background:#ffffff;border-radius:12px;overflow:hidden;border:1px solid #e2e8f0;">
<tr> <tr>
<td style="padding:28px 32px 8px 32px;text-align:center;"> <td style="padding:28px 32px 8px 32px;text-align:center;">
${BRAND_LOGO ? `<img src="${BRAND_LOGO}" alt="${BRAND_NAME}" style="height:40px;width:auto;max-width:200px;object-fit:contain;" />` : `<h1 style="margin:0;font-size:22px;color:#1e293b;font-weight:700;"><span style="color:${BRAND_ACCENT};">${BRAND_NAME}</span></h1>`} ${BRAND_LOGO ? `<img src="${BRAND_LOGO}" alt="${BRAND_NAME}" width="40" style="width:40px;height:auto;display:block;margin:0 auto 12px;" />` : ''}
<p style="margin:4px 0 0;color:#64748b;font-size:14px;">Digest notifications</p> <h1 style="margin:0;font-size:24px;color:#1e293b;font-weight:700;"><span style="color:${BRAND_ACCENT};">${BRAND_NAME}</span></h1>
</td> </td>
</tr> </tr>
<tr> <tr>
<td style="padding:16px 32px;color:#334155;font-size:15px;line-height:1.6;"> <td style="padding:16px 32px 24px;color:#334155;font-size:15px;line-height:1.6;">
<p style="margin:0 0 12px;">Welcome to ${BRAND_NAME}!</p> <p style="margin:0 0 12px;">Please click below to confirm your email address. We'll send occasional emails with updates from your communities on ${BRAND_NAME}.</p>
<p style="margin:0 0 12px;">Please confirm that you would like to receive ${sub.frequency} digests by clicking the button below:</p>
<p style="margin:0;text-align:center;"> <p style="margin:0;text-align:center;">
<a href="${href}" style="display:inline-block;background:${BRAND_ACCENT};color:#ffffff;padding:12px 28px;border-radius:8px;font-weight:600;text-decoration:none;">Confirm Digest</a> <a href="${href}" style="display:inline-block;background:${BRAND_ACCENT};color:#ffffff;padding:12px 28px;border-radius:8px;font-weight:600;text-decoration:none;">Confirm</a>
</p> </p>
<p style="margin:16px 0 0;font-size:12px;color:#94a3b8;">Or visit: <a href="${href}" style="color:${BRAND_ACCENT};">${EVENT_VIEWER_URL}</a></p> <p style="margin:16px 0 0;font-size:12px;color:#94a3b8;">To disable notifications, ignore this email. Or update your settings at <a href="${settingsUrl}" style="color:${BRAND_ACCENT};">${EVENT_VIEWER_URL.replace(/^https?:\/\//, '')}/settings/alerts</a>.</p>
</td> </td>
</tr> </tr>
</table> </table>
@ -61,7 +61,7 @@ export const sendConfirm = (sub: Subscription) => {
</tr> </tr>
</table> </table>
`, `,
text: `Please confirm that you would like to receive ${sub.frequency} digests by visiting: ${href}`, text: `Please click below to receive emails for updates from your communities on ${BRAND_NAME}.\n\nConfirm: ${href}\n\nTo disable notifications, ignore this email. Or update your settings at: ${settingsUrl}`,
}) })
.catch(error => { .catch(error => {
console.error('mailer: confirmation email failed', { console.error('mailer: confirmation email failed', {