Files
davidandClaude Opus 5.5 b6758417a3 Prospects: Listmonk mailing lists, and their opt-outs
Settings → Email → Mailing lists connects Listmonk (the Core's, by
default) with an API user and its token; Test reads the lists. A person
in Review can be added to a list, with their company, title and signal:
a double opt-in list asks them to confirm unless they already agreed; a
single opt-in list takes them only once they have; a suppressed address
is refused. Their card shows the lists they're on (a new list_members
table). Every hour, or on Sync now, everyone blocklisted in Listmonk or
unsubscribed from one of its lists goes on the suppression list, with
the reason; an address already there keeps its own.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 13:15:37 -07:00

103 lines
7.5 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 hx-disabled-elt="this" 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>
<form method="post" action="/settings/email/listmonk" autocomplete="off">
<section class="card" id="lists">
<h3>Mailing lists: Listmonk</h3>
<p class="small">Add a prospect to a newsletter or announcement list from Review (<em>Add to a mailing list</em>, on a person). Supermarket only adds people; Listmonk sends the campaigns. On a double opt-in list, Listmonk emails them to confirm unless you say they already agreed.</p>
<div class="cols">
<label>Listmonk's address <input name="listmonk_url" value="{{.Listmonk.URL}}" placeholder="https://listmonk.example.com"></label>
<label>API user <input name="listmonk_user" value="{{.Listmonk.User}}" placeholder="supermarket"><span class="help">In Listmonk: Admin → Users → New, type API, with a role that can manage subscribers and read lists.</span></label>
</div>
{{template "key-field" (dict "F" .LMToken "Set" .LMSet)}}
<div class="row">
<button type="submit" class="secondary small">Save</button>
{{if .LMSet}}<button hx-disabled-elt="this" type="button" class="secondary small" hx-post="/settings/email/listmonk/test" hx-target="#listmonk-test" hx-indicator="#testing-listmonk">Test</button>
<span id="testing-listmonk" class="htmx-indicator">Reading the lists…</span>{{end}}
</div>
<div id="listmonk-test"></div>
{{if .LMSet}}
<div class="row">
<button type="submit" class="secondary small" formaction="/settings/email/listmonk/sync" formnovalidate>Sync unsubscribes now</button>
<span class="small muted">Every hour, everyone blocklisted in Listmonk or unsubscribed from one of its lists goes on your <a href="/prospects/suppressed">suppression list</a>, so they're never added as a prospect or emailed in outreach again.</span>
</div>
{{with .OptOuts}}<p class="small {{if .Error}}error-text{{else}}muted{{end}}">Last synced {{ago .At}}: {{if .Error}}{{.Error}}{{else}}{{.Seen}} {{if eq .Seen 1}}person doesn't{{else}}people don't{{end}} want mail; {{.Added}} new on the suppression list.{{end}}</p>{{end}}
{{end}}
</section>
</form>
{{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}}
{{define "listmonk-test"}}
{{with .Error}}<ul class="checks"><li class="bad">{{.}}</li></ul>
{{else}}<ul class="checks"><li class="ok">It works: {{len .Lists}} {{if eq (len .Lists) 1}}list{{else}}lists{{end}}.</li></ul>
<ul class="small">{{range .Lists}}<li>{{.Name}} · {{.Type}}, {{if .Double}}double opt-in{{else}}single opt-in{{end}} · {{.Subscribers}} subscribers</li>{{end}}</ul>{{end}}
{{end}}