PrintToVeraeTimeStamp/internal/mailer/template.go
George Lambert 48da24a661 feat: 2026 brand UI — statuslang, tray/menubar, CERT pdf, site kit
- Brand receipt status strings (statuslang) for notify/queue
- Windows tray + Start Menu/Startup install; macOS menubar helper
- CERT-01 plum/gold PDF + multihash/blake3 when present
- printit.verae.ai brand kit, queue page, customer-auth helper
- verae-print pending/tray-status/menubar commands
2026-10-13 21:11:32 -04:00

103 lines
6 KiB
Go

package mailer
import (
"fmt"
"html"
"strings"
)
// CodeEmail renders the verification-code email (plain text + HTML).
func CodeEmail(to, name, code string, ttlMinutes int, client string) Message {
greet := "Hello"
if n := strings.TrimSpace(name); n != "" {
greet = "Hello " + n
}
if client == "" {
client = "the Verae installer"
}
spaced := code
if len(code) == 6 {
spaced = code[:3] + " " + code[3:]
}
text := fmt.Sprintf(`%s,
Your Verae verification code is:
%s
Enter it in %s to finish creating your Verae account.
The code expires in %d minutes and can be used once.
If you did not try to create a Verae account, you can ignore this email;
no account is created without this code.
Verae TimeStamp - https://customer.verae.ai/portal/
This is an automated message; replies are not monitored.
`, greet, spaced, client, ttlMinutes)
// Inline 2026 brand tokens (receipt-final.html shell): plum #531B59, gold #C4A85A,
// surface #F4F1F8, line #E3DEF0, ink #1D1534, muted #5E5470, subtle #6B6478.
e := html.EscapeString
htmlBody := fmt.Sprintf(`<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="color-scheme" content="light dark">
<title>Your Verae verification code</title></head>
<body style="margin:0;padding:0;background:#F4F1F8;font-family:Inter,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#1D1534;">
<table role="presentation" width="100%%" cellpadding="0" cellspacing="0" style="background:#F4F1F8;padding:24px 0;">
<tr><td align="center">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="width:600px;max-width:100%%;background:#FFFFFF;border-radius:14px;border:1px solid #E3DEF0;">
<tr><td style="padding:24px 28px 8px;font-size:18px;font-weight:700;color:#531B59;letter-spacing:.2px;">Verae<span style="display:inline-block;width:28px;height:3px;background:#C4A85A;border-radius:2px;margin-left:10px;vertical-align:middle;"></span></td></tr>
<tr><td style="padding:8px 28px 0;font-size:22px;font-weight:700;color:#1D1534;">Your verification code</td></tr>
<tr><td style="padding:6px 28px 0;font-size:15px;line-height:22px;color:#5E5470;">%s,</td></tr>
<tr><td style="padding:12px 28px 0;font-size:15px;line-height:22px;color:#5E5470;">Enter this code in %s to finish creating your Verae account:</td></tr>
<tr><td style="padding:16px 28px 0;">
<div style="padding:18px 0;text-align:center;background:#F7EFF8;border:1px solid #EBD9EE;border-radius:10px;font-family:JetBrains Mono,Menlo,Consolas,monospace;font-size:32px;font-weight:700;letter-spacing:8px;color:#531B59;">%s</div>
</td></tr>
<tr><td style="padding:16px 28px 0;font-size:13px;line-height:20px;color:#5E5470;">The code expires in <b style="color:#1D1534;">%d minutes</b> and can be used once.</td></tr>
<tr><td style="padding:8px 28px 0;font-size:13px;line-height:20px;color:#5E5470;">If you did not try to create a Verae account, ignore this email &mdash; no account is created without this code.</td></tr>
<tr><td style="padding:14px 28px 22px;border-top:1px solid #E3DEF0;font-size:11px;line-height:16px;color:#6B6478;">
<a href="https://customer.verae.ai/portal/" style="color:#531B59;text-decoration:none;font-weight:600;">customer.verae.ai</a>
&middot; Automated message; replies are not monitored.
&middot; Only a final blockchain receipt is evidence of a timestamp.
</td></tr></table>
</td></tr></table>
</body></html>
`, e(greet), e(client), e(code), ttlMinutes)
return Message{
To: to,
Subject: "Your Verae verification code: " + spaced,
Text: text,
HTML: htmlBody,
}
}
// AccountExistsEmail is sent instead of a code when someone registers an
// address that already has an account (so /install/register reveals nothing).
func AccountExistsEmail(to string) Message {
text := `Hello,
Someone (hopefully you) tried to create a new Verae account with this email
address, but you already have one.
To use the Verae printer, choose "Sign in to my Verae account" in the installer.
Forgot your password? Reset it at https://customer.verae.ai/portal/
If this wasn't you, you can ignore this email.
Verae TimeStamp - automated message; replies are not monitored.
`
htmlBody := `<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="color-scheme" content="light dark"><title>You already have a Verae account</title></head>
<body style="margin:0;padding:0;background:#F4F1F8;font-family:Inter,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#1D1534;">
<table role="presentation" width="100%" cellpadding="0" cellspacing="0" style="background:#F4F1F8;padding:24px 0;">
<tr><td align="center">
<table role="presentation" width="600" cellpadding="0" cellspacing="0" style="width:600px;max-width:100%;background:#FFFFFF;border-radius:14px;border:1px solid #E3DEF0;">
<tr><td style="padding:24px 28px 8px;font-size:18px;font-weight:700;color:#531B59;">Verae<span style="display:inline-block;width:28px;height:3px;background:#C4A85A;border-radius:2px;margin-left:10px;vertical-align:middle;"></span></td></tr>
<tr><td style="padding:8px 28px 0;font-size:22px;font-weight:700;color:#1D1534;">You already have a Verae account</td></tr>
<tr><td style="padding:12px 28px 0;font-size:15px;line-height:22px;color:#5E5470;">Someone (hopefully you) tried to create a new Verae account with this email address.</td></tr>
<tr><td style="padding:12px 28px 0;font-size:15px;line-height:22px;color:#5E5470;">In the installer choose <b style="color:#1D1534;">Sign in to my Verae account</b>. Forgot your password? Reset it at
<a href="https://customer.verae.ai/portal/" style="color:#531B59;font-weight:600;text-decoration:none;">customer.verae.ai</a>.</td></tr>
<tr><td style="padding:12px 28px 0;font-size:13px;line-height:20px;color:#5E5470;">If this wasn't you, ignore this email.</td></tr>
<tr><td style="padding:14px 28px 22px;border-top:1px solid #E3DEF0;font-size:11px;line-height:16px;color:#6B6478;">Automated message; replies are not monitored.</td></tr>
</table></td></tr></table></body></html>`
return Message{To: to, Subject: "You already have a Verae account", Text: text, HTML: htmlBody}
}