Transform messy email threads into beautifully formatted, chronological conversations.
Clean Forward is a Gmail add-on that strips quoted text, reply headers, and signatures from email threads, then presents them in a clean, timeline-style format. Perfect for forwarding long conversations without the clutter.
- Smart Quote Removal: Automatically strips quoted text, reply headers, and email signatures
- Timeline View: Beautiful, chronological display with visual timeline dots
- Participant Summary: Shows all unique participants in the conversation
- Attachment De-duplication: Collects all attachments without duplicates
- URL Linkification: Automatically converts URLs to clickable links
- Clean Formatting: Preserves lists, structure, and intentional formatting
- One-Click Access: Opens draft directly from the add-on
- Modern Design: Professional, readable layout with consistent styling
Cluttered email with quoted text, reply headers, and signatures taking up most of the space.
Clean, timeline-style conversation showing only the important content from each participant.
- A Google account with Gmail access
- clasp installed (
npm install -g @google/clasp)
-
Clone the repository
git clone https://github.com/573dave/clean-forward-gmail.git cd clean-forward-gmail -
Login to clasp
clasp login
-
Create a new Google Apps Script project
clasp create --type standalone --title "Clean Forward" -
Push the code
clasp push
-
Deploy the add-on
clasp deploy
-
Enable the add-on in Gmail
- Open the Google Apps Script dashboard
- Find your "Clean Forward" project
- Click "Deploy" β "Test deployments"
- Install the test deployment
If you prefer not to use clasp, you can set up the add-on directly in the browser:
-
Create a new Apps Script project
- Visit script.new in your browser
- This creates a new Google Apps Script project
-
Rename the project
- Click "Untitled project" at the top
- Rename it to "Clean Forward"
-
Enable manifest file visibility
- Click the gear icon (Project Settings) in the left sidebar
- Check the box "Show appsscript.json in editor"
-
Add the main code file
- In the editor, you should see
Code.gs - Copy the entire contents of
src/Code.jsfrom this repository - Paste it into the
Code.gsfile, replacing any existing content - Save with
Ctrl+S(Windows/Linux) orCmd+S(Mac)
- In the editor, you should see
-
Update the manifest
- Click on
appsscript.jsonin the left sidebar - Copy the entire contents of
src/appsscript.jsonfrom this repository - Paste it into the
appsscript.jsonfile, replacing any existing content - Save with
Ctrl+S(Windows/Linux) orCmd+S(Mac)
- Click on
-
Deploy the add-on
- Click "Deploy" β "Test deployments" at the top right
- Click "Install" to install the test deployment
- Authorize the app when prompted (it needs Gmail access)
-
Use the add-on
- Open Gmail
- Open any email thread
- Look for the "Clean Forward" icon in the right sidebar
- Click it to start using the add-on!
- Open any email thread in Gmail
- Click the "Clean Forward" icon in the sidebar
- Click "Create clean forward draft"
- Click "View Draft" to open your cleaned-up email
- Edit and send as needed!
The add-on will:
- Remove all quoted text and reply headers
- Sort messages chronologically (oldest to newest)
- Display each message in a clean card format
- Include a participant summary at the top
- Preserve and de-duplicate all attachments
- Convert URLs to clickable links
buildAddOn(e): Entry point that builds the Gmail sidebar UIcreateCleanForwardFromContext(e): Main action handler for draft creationstripQuotedText_(plainBody): Core text cleaning enginecreateCleanForwardDraftFromThread_(thread): Processes thread and generates HTMLcleanUnicodeArtifacts_(text): Handles encoding issues and emojicollapseSoftLineBreaks_(text): Preserves intentional formatting
- Unicode Normalization:
cleanUnicodeArtifacts_ - Plain Text Cleanup:
cleanPlainTextArtifacts_ - Quote Detection:
stripQuotedText_with 20+ regex patterns - Structure Preservation:
collapseSoftLineBreaks_ - HTML Generation:
textToHtml_with URL linkification
The HTML output uses inline styles for maximum compatibility. To customize the appearance, edit the CSS in createCleanForwardDraftFromThread_():
- Colors: Modify the color hex codes (e.g.,
#2563ebfor blue accent) - Fonts: Change the
font-familystack - Spacing: Adjust
paddingandmarginvalues - Timeline: Customize the dot size and colors in
dotColor
To add custom quote patterns, update the REGEX_PATTERNS_ object:
const REGEX_PATTERNS_ = {
// Add your custom pattern
customPattern: /^your regex here$/i,
// ... existing patterns
};Then add detection logic in stripQuotedText_().
clean-forward-gmail/
βββ src/
β βββ Code.js # Main add-on code
β βββ appsscript.json # Add-on manifest
βββ .clasp.json # Clasp configuration
βββ .gitignore # Git ignore rules
βββ LICENSE # MIT License
βββ README.md # This file
βββ CONTRIBUTING.md # Contribution guidelines
# Push code to Google Apps Script
clasp push
# Pull latest from Google Apps Script
clasp pull
# Open project in browser
clasp open
# View logs
clasp logs- Make changes to
src/Code.js - Run
clasp pushto deploy - Test in Gmail by opening an email thread
- Check logs with
clasp logsif issues occur
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
- Support for inline replies (extracting text between quotes)
- Optional LLM integration for even smarter cleaning
- Customizable styling via user preferences
- Support for multiple languages
- Thread summarization for very long conversations
- Export to other formats (Markdown, PDF)
- Google Workspace account (personal Gmail works too)
- Gmail enabled
- Google Apps Script access
The add-on requires the following scopes:
gmail.addons.execute- Run as a Gmail add-ongmail.readonly- Read email threadsgmail.compose- Create draft emails
- Very long threads (100+ messages) may take a few seconds to process
- Some exotic email clients may have unrecognized quote patterns
- Attachments are de-duplicated by name+size (not content hash)
This project is licensed under the MIT License - see the LICENSE file for details.
573dave
- GitHub: @573dave
- Built with Google Apps Script
- Deployed with clasp
If you encounter issues or have questions:
- Check the Issues page
- Create a new issue with details about your problem
- Include:
- Steps to reproduce
- Expected vs actual behavior
- Screenshot if applicable
- Logs from
clasp logs
Made with β€οΈ for everyone tired of forwarding messy email threads