Reads the mail that arrived in the window you set and emails you one digest of what matters and what needs doing.
Uses
Gmail
OpenAI
Inbox digest with your next actions
Every day at 07:30, the mail that arrived in your inbox during the window you choose is read and turned into one digest email. AI writes two short sections from it: what matters, grouping related messages and naming the sender, and what needs doing, one line per task, each starting with a verb and naming who it came from.
You get a single email whose subject says how many messages it covers. A quiet inbox still gets a digest saying nothing arrived, so you always know the run happened and there is genuinely nothing waiting. A message without a readable sender, subject or preview is left out and counted at the foot of the digest rather than stopping the run, and if the summary cannot be written the digest still arrives carrying the plain list of what came in.
Nothing needs to exist beforehand beyond your Gmail account and the address the digest should go to. A second copy with an evening time and a shorter window gives you a second digest covering the day.
digestTo to blank.Set digestTo to blank.digestTitle to Morning inbox digest.Set digestTitle to Morning inbox digest.mailWindow to newer_than:1d.Set mailWindow to newer_than:1d.windowLabel to since this time yesterday.Set windowLabel to since this time yesterday.maxEmails to 40.Set maxEmails to 40.mailWindow. Save it as mail.List emails matching mailWindow. Save it as mail.messages to mail.emails.Set messages to mail.emails.lines to an empty list.Set lines to an empty list.skipped to 0.Set skipped to 0.email in messages:For each email in messages:unreadableIf a step below fails, save the error as unreadableemail.from and save it as sender.Trim email.from and save it as sender.email.subject and save it as subject.Trim email.subject and save it as subject.email.snippet and save it as preview.Trim email.snippet and save it as preview.sender | subject | preview to the end of lines and save it as lines.Add - From sender | subject | preview to the end of lines and save it as lines.skipped.Add 1 to skipped.unreadable as text.Show in the output: Left a message out of the digest: unreadable as text.lines and save it as mailCount.Count the items in lines and save it as mailCount.lines with a new line and save it as mailList.Join lines with a new line and save it as mailList.subjectLine to blank.Set subjectLine to blank.digestBody to blank.Set digestBody to blank.mailCount is 0If mailCount is 0subjectLine to digestTitle - nothing new.Change subjectLine to digestTitle - nothing new.skipped is greater than 0If skipped is greater than 0digestBody to Nothing could be read windowLabel, so there is nothing to summarise.Change digestBody to Nothing could be read windowLabel, so there is nothing to summarise.digestBody to Nothing arrived windowLabel. Your inbox is clear and there is nothing waiting on you.Change digestBody to Nothing arrived windowLabel. Your inbox is clear and there is nothing waiting on you.subjectLine to digestTitle - mailCount to read.Change subjectLine to digestTitle - mailCount to read.summaryErrorIf a step below fails, save the error as summaryErrormailList'. Save it as answer.answer.response_text and save it as digestBody.Trim answer.response_text and save it as digestBody.summaryError as text.Show in the output: The summary step did not run: summaryError as text.digestBody is emptyIf digestBody is emptydigestBody to A summary could not be produced this time, so here is everything that arrived.Change digestBody to A summary could not be produced this time, so here is everything that arrived.
mailList.skippedNote to blank.Set skippedNote to blank.skipped is greater than 0If skipped is greater than 0skippedNote to Change skippedNote to
Left out skipped message(s) that arrived without a readable sender, subject or preview.fullBody to digestTitleSet fullBody to digestTitle
Covering windowLabel.
Messages in this digest: mailCount
digestBody@skippedNote.digestTo.Send an email to digestTo.
Subject: subjectLinefullBody