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:
2026-11-22 06:09:47 -07:00
co-authored by Claude Opus 5.5
parent 82d569da9c
commit c2772a7927
26 changed files with 3079 additions and 3 deletions
+22
View File
@@ -60,6 +60,9 @@ type Server struct {
redditAppTokenExp time.Time
redditHist []reddit.Submission
redditHistAt time.Time
// sending lets one email go out at a time, from the queue or Send now.
sending sync.Mutex
}
// Handler builds the routes.
@@ -151,6 +154,15 @@ func (s *Server) Handler() (http.Handler, error) {
mux.HandleFunc("GET /settings/sources", s.sourcesPage)
mux.HandleFunc("POST /settings/sources", s.sourcesSave)
mux.HandleFunc("POST /settings/sources/test/{source}", s.sourcesTest)
mux.HandleFunc("GET /settings/email", s.emailPage)
mux.HandleFunc("POST /settings/email", s.emailSave)
mux.HandleFunc("POST /settings/email/test", s.emailTest)
mux.HandleFunc("POST /settings/email/send-test", s.emailSendTest)
mux.HandleFunc("GET /outreach", s.outreachPage)
mux.HandleFunc("POST /outreach/draft", s.outreachDraft)
mux.HandleFunc("POST /outreach/draft-many", s.outreachDraftMany)
mux.HandleFunc("POST /outreach/check", s.outreachCheck)
mux.HandleFunc("POST /outreach/{id}/{action}", s.outreachAction)
mux.HandleFunc("GET /crm", s.crmPage)
mux.HandleFunc("GET /crm/reach", s.crmReach)
mux.HandleFunc("POST /crm/{action}", s.crmAction)
@@ -302,6 +314,7 @@ type page struct {
Query string // the search box's text
NewProspects int // companies and people waiting for review, shown in the menu
Drafts int // outreach drafts waiting, shown in the menu
}
// Section is the top bar's first breadcrumb, from Nav.
@@ -349,6 +362,7 @@ func (s *Server) render(w http.ResponseWriter, r *http.Request, name string, p p
p.Version = s.Version
p.Inbox = s.inboxCount()
p.NewProspects = s.newProspects()
p.Drafts = s.outreachDrafts()
if p.Flash == "" {
p.Flash = flashes[r.URL.Query().Get("msg")]
}
@@ -392,6 +406,14 @@ var flashes = map[string]string{
"imported": "Imported.",
"hunter-done": "Hunter.io search done: the result is on the card.",
"verified": "Checked with Hunter.io: the result is on each person.",
"drafted-outreach": "Drafted. Read it, edit it, then queue it to send.",
"queued": "Queued: it goes out in turn, within your sending hours.",
"unqueued": "Back in Drafts.",
"sent": "Sent.",
"marked-sent": "Marked as sent.",
"reply-recorded": "Reply recorded.",
"checked": "Inbox checked: what it found is above.",
"test-sent": "Test email sent: check your inbox.",
"oauth-expired": "That sign-in took too long or was already used. Try again.",
"dismissed": "Dismissed.",
"restored": "Restored.",