Files
supermarket/internal/web/templates/email.html
T
davidandClaude Opus 5.5 d23d5e2a87 Phase 2 part 7: the end of the funnel
Posts can be written for a buying signal: the prompt gets its hypothesis
and angle, and links carry its campaign tag. Plausible (Stats API v2) is
read once a day for visitors on tagged links, recorded per signal as
Visited. Stripe (restricted key) is read every hour: $0 checkouts are
Signed up, paid invoices and one-time payments are Paid with their value,
tied to a signal by the checkout's utm_campaign metadata or the payer's
email. The Core's Cal.com has no API, so booking emails from Cal.com in
the outreach mailbox count as Booked. New Settings → Website & sales;
the signal page lists its posts and tagged links. Schema 11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 06:42:03 -07:00

72 lines
5.1 KiB
HTML

{{define "content"}}{{template "settings-start" .}}{{with .Data}}{{$s := .S}}
<h2>Email</h2>
<p class="lede">The mailbox outreach is sent from, on your Core's mail server, and the rules for sending. Every email is written for one person, reviewed by you, and sent one at a time. Supermarket reads the inbox only to find replies, bounces and requests to stop: it never marks, moves or deletes anything there.</p>
<p class="help">A mailbox used only for outreach (for example <code>hello@</code> your domain) keeps replies apart from your own mail, and keeps a complaint from touching your everyday address.</p>
<form method="post" action="/settings/email" autocomplete="off">
<section class="card">
<h3>Mailbox</h3>
<div class="cols">
<label>From name <input name="from_name" value="{{$s.FromName}}" placeholder="Pat Lee"></label>
<label>From address <input name="from_address" type="email" value="{{$s.FromAddress}}" placeholder="pat@example.com"></label>
</div>
<div class="cols">
<label>User name <input name="username" value="{{$s.Username}}" placeholder="usually the address"></label>
<div>{{template "key-field" (dict "F" .Password "Set" .Set)}}</div>
</div>
<div class="cols">
<label>Sending server (SMTP) <input name="smtp_host" value="{{$s.SMTPHost}}" placeholder="mail.example.com"></label>
<label>Port <input name="smtp_port" inputmode="numeric" value="{{$s.SMTPPort}}" size="5">
<span class="help">587 (STARTTLS) or 465 (TLS).</span></label>
</div>
<div class="cols">
<label>Reading server (IMAP) <input name="imap_host" value="{{$s.IMAPHost}}" placeholder="the same, usually"></label>
<label>Port <input name="imap_port" inputmode="numeric" value="{{$s.IMAPPort}}" size="5">
<span class="help">993 (TLS).</span></label>
</div>
<label class="check"><input type="checkbox" name="read_replies" {{if $s.ReadReplies}}checked{{end}}> Read the inbox every 10 minutes for replies, bounces and requests to stop</label>
<label class="check"><input type="checkbox" name="save_to_sent" {{if $s.SaveToSent}}checked{{end}}> Put a copy of each email in the Sent folder</label>
</section>
<section class="card">
<h3>Sending</h3>
<div class="cols">
<label>Emails a day, at most <input name="daily_limit" inputmode="numeric" value="{{$s.DailyLimit}}" size="4">
<span class="help">Start low (10 to 20) while the mailbox builds a reputation.</span></label>
<label>Minutes between emails, at least <input name="gap_minutes" inputmode="numeric" value="{{$s.GapMinutes}}" size="4"></label>
</div>
<div class="cols">
<label>Between
<select name="start_hour">{{range .Hours}}{{if lt . 24}}<option value="{{.}}" {{if eq . $s.StartHour}}selected{{end}}>{{.}}:00</option>{{end}}{{end}}</select></label>
<label>and
<select name="end_hour">{{range .Hours}}{{if gt . 0}}<option value="{{.}}" {{if eq . $s.EndHour}}selected{{end}}>{{.}}:00</option>{{end}}{{end}}</select>
<span class="help">Your local time.</span></label>
</div>
<label class="check"><input type="checkbox" name="weekends" {{if $s.Weekends}}checked{{end}}> Send on weekends too</label>
<label>Scheduling link <span class="muted small">(optional)</span> <input name="scheduling_link" value="{{$s.SchedulingLink}}" placeholder="https://cal.example.com/you/30min">
<span class="help">Offered as the next step when a call fits. Booking through it counts as Booked once Cal.com is connected.</span></label>
<label>Cal.com's sending address <span class="muted small">(optional)</span> <input name="booking_from" value="{{$s.BookingFrom}}" placeholder="the From address of Cal.com's booking emails">
<span class="help">Cal.com emails you about every booking. With its address here, each new booking email in this mailbox counts as Booked for the person who booked (cancellations and reschedules don't). Open one of those emails and copy its From address. Needs the inbox reading above.</span></label>
<label>Signature <textarea name="footer" rows="5">{{$s.Footer}}</textarea>
<span class="help">Added under every email. Keep a way to opt out: a reply of “stop” puts the address on your suppression list.</span></label>
</section>
<div class="actions"><button type="submit">Save</button></div>
</form>
<section class="card">
<h3>Check</h3>
<p class="small">Signs in to both servers and looks up your domain's SPF, DKIM and DMARC records, which decide whether outreach reaches the inbox. Nothing is sent.</p>
<div class="row">
<button type="button" class="secondary small" hx-post="/settings/email/test" hx-target="#email-test" hx-indicator="#testing-email">Check the settings</button>
<form method="post" action="/settings/email/send-test" data-busy="Sending…"><button type="submit" class="secondary small">Send a test email to {{or $s.FromAddress "the From address"}}</button></form>
<span id="testing-email" class="htmx-indicator">Checking…</span>
</div>
<div id="email-test"></div>
</section>
{{end}}{{template "settings-end"}}{{end}}
{{define "email-test"}}
<ul class="checks">{{range .}}<li class="{{if .OK}}ok{{else}}bad{{end}}">{{.Text}}</li>{{end}}</ul>
{{end}}