Phase 2 part 6: outreach by email and LinkedIn
Drafts are written by the AI from the person's buying signal (hypothesis and angle), their company and their history, then reviewed and edited. Queued emails go out through the Core's mail server one at a time, within the sending hours, the daily limit and a gap, never to a suppressed or bouncing address or someone emailed in the last 14 days; with a signature, an opt-out line, UTM-tagged links and a copy in Sent. The inbox is read read-only every 10 minutes: replies (by Message-ID or sender) count as Replied, bounces mark the address, and "stop" replies are suppressed. LinkedIn messages are copied, sent by hand and marked sent. New pages: Prospects → Outreach and Settings → Email (with an SMTP, IMAP, SPF, DKIM and DMARC check). Schema 10; emersion/go-imap for IMAP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
{{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>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}}
|
||||
@@ -42,6 +42,7 @@
|
||||
<div class="subnav">
|
||||
<a href="/signals" {{if eq $nav "prospects/signals"}}aria-current="page"{{end}}>Signals</a>
|
||||
<a href="/prospects" {{if eq $nav "prospects/review"}}aria-current="page"{{end}}>Review{{with $.NewProspects}} <span class="count-badge" title="{{.}} waiting for review">{{.}}</span>{{end}}</a>
|
||||
<a href="/outreach" {{if eq $nav "prospects/outreach"}}aria-current="page"{{end}}>Outreach{{with $.Drafts}} <span class="count-badge" title="{{.}} drafts to review">{{.}}</span>{{end}}</a>
|
||||
<a href="/prospects/suppressed" {{if eq $nav "prospects/suppressed"}}aria-current="page"{{end}}>Suppression list</a>
|
||||
<a href="/crm" {{if eq $nav "prospects/crm"}}aria-current="page"{{end}}>CRM queue</a>
|
||||
</div>
|
||||
@@ -92,6 +93,7 @@
|
||||
<a href="/settings/accounts" {{if eq .Nav "settings/accounts"}}aria-current="page"{{end}}>{{template "icon" "accounts"}}Social accounts</a>
|
||||
<a href="/settings/core" {{if eq .Nav "settings/core"}}aria-current="page"{{end}}>{{template "icon" "core"}}Core & Hermes</a>
|
||||
<a href="/settings/sources" {{if eq .Nav "settings/sources"}}aria-current="page"{{end}}>{{template "icon" "prospects"}}Lead sources</a>
|
||||
<a href="/settings/email" {{if eq .Nav "settings/email"}}aria-current="page"{{end}}>{{template "icon" "email"}}Email</a>
|
||||
<div class="nav-label">AI</div>
|
||||
<a href="/settings/ai" {{if eq .Nav "settings/ai"}}aria-current="page"{{end}}>{{template "icon" "ai"}}AI</a>
|
||||
</nav>
|
||||
@@ -132,6 +134,7 @@
|
||||
{{- else if eq . "inventory"}}<path d="m16 6 4 14"/><path d="M12 6v14"/><path d="M8 8v12"/><path d="M4 4v16"/>
|
||||
{{- else if eq . "content"}}<path d="M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2"/><path d="M18 14h-8"/><path d="M15 18h-5"/><path d="M10 6h8v4h-8V6Z"/>
|
||||
{{- else if eq . "prospects"}}<path d="M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"/><circle cx="9" cy="7" r="4"/><path d="M22 21v-2a4 4 0 0 0-3-3.87"/><path d="M16 3.13a4 4 0 0 1 0 7.75"/>
|
||||
{{- else if eq . "email"}}<rect width="20" height="16" x="2" y="4" rx="2"/><path d="m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"/>
|
||||
{{- else if eq . "seo"}}<polyline points="22 7 13.5 15.5 8.5 10.5 2 17"/><polyline points="16 7 22 7 22 13"/>
|
||||
{{- else if eq . "metrics"}}<path d="M3 3v18h18"/><path d="M18 17V9"/><path d="M13 17V5"/><path d="M8 17v-3"/>
|
||||
{{- else if eq . "sites"}}<circle cx="12" cy="12" r="10"/><path d="M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20"/><path d="M2 12h20"/>
|
||||
|
||||
@@ -0,0 +1,119 @@
|
||||
{{define "content"}}{{with .Data}}{{$d := .}}{{$tab := .Tab}}
|
||||
<div class="heading">
|
||||
<h1>Outreach</h1>
|
||||
<div class="buttons">
|
||||
{{if not .NotReady}}<form method="post" action="/outreach/check" data-busy="Reading…"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary">Check for replies</button></form>{{end}}
|
||||
</div>
|
||||
</div>
|
||||
<p class="lede">Emails and LinkedIn messages to the people you accepted, each written from their buying signal's angle. Read and edit every draft: emails you queue go out one at a time, within your sending hours and daily limit; LinkedIn messages you send yourself. Replies, bounces and requests to stop come back from the inbox into the funnel.</p>
|
||||
|
||||
<section class="card status-line">
|
||||
{{if not .Configured}}<p class="warn-text">Set up the mailbox under <a href="/settings/email">Settings → Email</a> before queuing emails. You can draft already.</p>
|
||||
{{else if .NotReady}}<p class="warn-text">Sending is off: {{.NotReady}}.</p>
|
||||
{{else}}
|
||||
<p><strong>{{.SentToday}}</strong> of {{.S.DailyLimit}} emails sent today{{with .Counts.queued}}, <strong>{{.}}</strong> queued{{end}}. {{if .Window}}Paused: {{.Window}}.{{else}}Sending now, one every {{.S.GapMinutes}} minutes or more.{{end}}</p>
|
||||
{{with .LastCheck}}<p class="small muted">Inbox read {{ago .At}}{{if .Error}}: <span class="error-text">{{.Error}}</span>{{else}}: {{.Read}} new {{if eq .Read 1}}message{{else}}messages{{end}}{{if .Replies}}, {{.Replies}} {{if eq .Replies 1}}reply{{else}}replies{{end}}{{end}}{{if .Bounces}}, {{.Bounces}} bounced{{end}}{{if .Stops}}, {{.Stops}} asked to stop{{end}}{{if .AutoReplies}}, {{.AutoReplies}} automatic{{end}}.{{end}}</p>{{end}}
|
||||
{{end}}
|
||||
</section>
|
||||
|
||||
{{if or .Emailable .Linkable}}
|
||||
<form method="post" action="/outreach/draft-many" class="card row wrap" data-busy="Writing…">
|
||||
<span>Write to accepted people nobody has written to yet ({{.Emailable}} with an email address, {{.Linkable}} on LinkedIn), 5 at a time:</span>
|
||||
<select name="channel"><option value="email">Email</option><option value="linkedin">LinkedIn</option></select>
|
||||
{{if .Signals}}<select name="signal"><option value="0">any signal</option>{{range .Signals}}<option value="{{.ID}}">{{.Name}}</option>{{end}}</select>{{end}}
|
||||
<button type="submit" class="secondary small">Draft</button>
|
||||
</form>
|
||||
{{end}}
|
||||
|
||||
<nav class="tabs">
|
||||
{{range .Tabs}}<a href="/outreach?tab={{.ID}}" {{if eq $tab .ID}}aria-current="page"{{end}}>{{.Label}}{{with index $d.Counts .ID}} <span class="muted">{{.}}</span>{{end}}</a>{{end}}
|
||||
</nav>
|
||||
|
||||
{{range .Messages}}{{$m := .}}
|
||||
<section class="card message" id="m-{{.ID}}">
|
||||
<div class="prospect-head">
|
||||
<div>
|
||||
<h2>{{.Contact.Name}}{{with .Contact.Title}} <span class="muted small">{{.}}</span>{{end}}{{with .Company}} <span class="muted small">at {{.}}</span>{{end}}</h2>
|
||||
<p class="meta">
|
||||
<span class="badge">{{if eq .Channel "email"}}Email{{else}}LinkedIn{{end}}</span>
|
||||
{{if eq .Channel "email"}}{{.To}}{{if eq .Contact.EmailStatus "valid"}} <span class="badge published">verified</span>{{else if eq .Contact.EmailStatus "risky"}} <span class="badge">risky</span>{{else if eq .Contact.EmailStatus "invalid"}} <span class="badge failed">bounces</span>{{else}} <span class="muted">not verified</span>{{end}}
|
||||
{{else}}<a href="{{.Contact.LinkedIn}}" target="_blank" rel="noopener noreferrer">LinkedIn profile ↗</a>{{end}}
|
||||
{{with index $d.SignalNames .SignalID}} · signal <strong>{{.}}</strong>{{end}}
|
||||
· written {{ago .CreatedAt}}{{if not .SentAt.IsZero}} · sent {{ago .SentAt}}{{end}}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if eq .Status "draft"}}
|
||||
{{if eq .Channel "email"}}
|
||||
<form method="post" action="/outreach/{{.ID}}/save">
|
||||
<input type="hidden" name="tab" value="{{$tab}}">
|
||||
<label>Subject <input name="subject" value="{{.Subject}}"></label>
|
||||
<label>Email <textarea name="body" rows="9">{{.Body}}</textarea>
|
||||
<span class="help">Your signature and the opt-out line are added under it. Links to your sites get UTM tags for this signal.</span></label>
|
||||
<div class="actions">
|
||||
<button type="submit" formaction="/outreach/{{.ID}}/queue">Queue to send</button>
|
||||
<button type="submit" class="secondary">Save</button>
|
||||
<button type="submit" class="secondary" formaction="/outreach/{{.ID}}/discard" data-confirm="Discard this draft?">Discard</button>
|
||||
</div>
|
||||
</form>
|
||||
{{else}}
|
||||
<form method="post" action="/outreach/{{.ID}}/mark-sent">
|
||||
<input type="hidden" name="tab" value="{{$tab}}">
|
||||
<label>Message <textarea name="body" id="li-{{.ID}}" rows="6" maxlength="{{$d.Limit}}" data-count="linkedin" data-limit="{{$d.Limit}}" aria-describedby="li-count-{{.ID}}">{{.Body}}</textarea>
|
||||
<p class="count" id="li-count-{{.ID}}"></p>
|
||||
<span class="help">Copy it, open their profile, and send it there (as a message, or a note with a connection request); then mark it sent.</span></label>
|
||||
<div class="actions">
|
||||
<button type="button" class="secondary" data-copy="li-{{.ID}}">Copy</button>
|
||||
<a class="button secondary" href="{{.Contact.LinkedIn}}" target="_blank" rel="noopener noreferrer">Open their profile ↗</a>
|
||||
<button type="submit">Mark as sent</button>
|
||||
<button type="submit" class="secondary" formaction="/outreach/{{.ID}}/save">Save</button>
|
||||
<button type="submit" class="secondary" formaction="/outreach/{{.ID}}/discard" data-confirm="Discard this draft?">Discard</button>
|
||||
</div>
|
||||
</form>
|
||||
{{end}}
|
||||
|
||||
{{else if eq .Status "queued"}}
|
||||
{{template "message-text" .}}
|
||||
<div class="actions">
|
||||
<form method="post" action="/outreach/{{.ID}}/send-now" data-busy="Sending…"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="small">Send now</button></form>
|
||||
<form method="post" action="/outreach/{{.ID}}/unqueue"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Back to drafts</button></form>
|
||||
</div>
|
||||
|
||||
{{else}}
|
||||
{{template "message-text" .}}
|
||||
{{with .Error}}<p class="{{if eq $m.Status "sent"}}warn-text{{else}}error-text{{end}} small">{{.}}</p>{{end}}
|
||||
{{if not .RepliedAt.IsZero}}
|
||||
<div class="reply"><p class="small muted">They replied {{ago .RepliedAt}}:</p><blockquote>{{.Reply}}</blockquote></div>
|
||||
{{else if and (eq .Status "sent") (eq .Channel "linkedin")}}
|
||||
<details class="outcome"><summary class="small">They replied</summary>
|
||||
<form method="post" action="/outreach/{{.ID}}/replied" class="row wrap">
|
||||
<input type="hidden" name="tab" value="{{$tab}}">
|
||||
<label class="small grow">What they said <input name="reply" placeholder="optional"></label>
|
||||
<button type="submit" class="secondary small">Record the reply</button>
|
||||
</form>
|
||||
</details>
|
||||
{{end}}
|
||||
{{if eq .Status "failed"}}
|
||||
<div class="actions">
|
||||
<form method="post" action="/outreach/{{.ID}}/queue"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Queue again</button></form>
|
||||
<form method="post" action="/outreach/{{.ID}}/discard"><input type="hidden" name="tab" value="{{$tab}}"><button type="submit" class="secondary small">Discard</button></form>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</section>
|
||||
{{else}}
|
||||
<section class="card empty">
|
||||
{{if eq $tab "draft"}}<p>No drafts. Write one from a person in <a href="/prospects?status=accepted">Review</a>, or draft for several accepted people above.</p>
|
||||
{{else if eq $tab "queued"}}<p>Nothing queued.</p>
|
||||
{{else if eq $tab "sent"}}<p>Nothing sent yet.</p>
|
||||
{{else if eq $tab "replied"}}<p>No replies yet.</p>
|
||||
{{else}}<p>Nothing failed or bounced.</p>{{end}}
|
||||
</section>
|
||||
{{end}}
|
||||
{{end}}{{end}}
|
||||
|
||||
{{define "message-text"}}
|
||||
{{if .Subject}}<p><strong>{{.Subject}}</strong></p>{{end}}
|
||||
<div class="message-body">{{.Body}}</div>
|
||||
{{end}}
|
||||
@@ -119,6 +119,13 @@
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{template "enrich-run" (index $d.Runs (printf "contact:%d" $p.ID))}}
|
||||
{{with index $d.Messages $p.ID}}<div class="small">{{range .}}<a href="/outreach?tab={{if .RepliedAt.IsZero}}{{if eq .Status "bounced"}}failed{{else}}{{.Status}}{{end}}{{else}}replied{{end}}#m-{{.ID}}">{{if eq .Channel "email"}}Email{{else}}LinkedIn message{{end}} {{if not .RepliedAt.IsZero}}replied to {{ago .RepliedAt}}{{else if eq .Status "sent"}}sent {{ago .SentAt}}{{else if eq .Status "draft"}}drafted{{else if eq .Status "failed"}}didn't go{{else}}{{.Status}}{{end}}</a> {{end}}</div>{{end}}
|
||||
{{if ne $p.Status "rejected"}}
|
||||
<div class="row wrap">
|
||||
{{if and $p.Email (ne $p.EmailStatus "invalid")}}<form method="post" action="/outreach/draft" data-busy="Writing…"><input type="hidden" name="contact" value="{{$p.ID}}"><input type="hidden" name="channel" value="email"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Write an email</button></form>{{end}}
|
||||
{{if $p.LinkedIn}}<form method="post" action="/outreach/draft" data-busy="Writing…"><input type="hidden" name="contact" value="{{$p.ID}}"><input type="hidden" name="channel" value="linkedin"><input type="hidden" name="tab" value="{{$tab}}"><input type="hidden" name="filter" value="{{$d.Signal}}"><button type="submit" class="link small">Write a LinkedIn message</button></form>{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
{{if not $p.CompanyID}}{{template "signal-tag" dict "Kind" "contact" "ID" $p.ID "SignalID" $p.SignalID "D" $d}}{{end}}
|
||||
{{with index .Matches (printf "contact:%d" $p.ID)}}{{template "crm-matches" .}}{{end}}
|
||||
{{template "outcomes" dict "Kind" "contact" "ID" $p.ID "Tab" $tab "D" $d}}
|
||||
|
||||
Reference in New Issue
Block a user