Email Newsletter Digest (Gmail + GPT-4o)
This script automatically summarizes your email newsletters from specific senders using OpenAI’s GPT-4o and sends you a clean HTML digest once per day. Built entirely in Google Apps Script.
What It Does
- Filters unread Gmail threads from specific senders in the last 48 hours
- Uses GPT-4o-mini to summarize email content into bullet points
- Formats each summary as clean, readable HTML
- Sends a single email digest to your inbox
- Marks messages as read after processing
What You’ll Need
- A Gmail account
- An OpenAI API key
- A few minutes in the Google Apps Script editor
Setup Instructions
1. Open Google Apps Script
- Go to https://script.google.com
- Click
+ New Project - Name your project something like
Email Newsletter Digest
2. Replace Default Code
- Delete any starter code (like
function myFunction()) - Copy and paste the entire contents of
Code.gsinto the editor:- This includes the
summarizeUnreadEmailsFromSendersLast24Hoursfunction and helpers
- This includes the
- (Optional but recommended) Create a second file named
appsscript.jsonwith:
{
"timeZone": "America/Chicago",
"exceptionLogging": "STACKDRIVER"
}