Skip to content

Gmail Reader is a Go script designed to mark emails as read. Nothing serious, just something I hacked together a couple of months ago to mark all my unread emails as read. I thought it might be useful to someone else, so I decided to share it.

License

Notifications You must be signed in to change notification settings

sudodeo/gmail-reader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gmail Reader

Overview

Gmail Reader is a Go script designed to mark emails as read. Nothing serious, just something I hacked together a couple of months ago to mark all my unread emails as read. I thought it might be useful to someone else, so I decided to share it.

Prerequisites

Before using the script, ensure you have set up the necessary credentials:

  1. Go to the Google Cloud Console.
  2. Create or select a project.
  3. Enable the Gmail API.
  4. Create OAuth 2.0 Client ID credentials.
  5. Download the credentials as credentials.json and place it in the project directory.

Usage

  1. Download the Binary:

  2. Authentication:

    • For the first run, follow on-screen instructions to authenticate and mark emails as read.
    • To switch accounts, delete token.json and re-run the script.

Extracting the Authentication Code

  1. Run the Script:

    • On Windows: .\gmail-reader.exe
    • On macOS/Linux: ./gmail-reader
  2. Authorization Page:

    • Opened in your default browser, log in to the Gmail account to grant permissions.
  3. Grant Permissions:

    • Click "Allow" to grant necessary permissions.
  4. Extract the Code:

    • Copy the authentication code from the URL after granting permissions.
  5. Paste the Code:

    • Return to the terminal and paste the code when prompted.
  6. Complete Authentication:

    • Press Enter to finish the process.
  7. Continue Script Execution:

    • The script proceeds to mark emails as read.

Troubleshooting: Invalid Grant Error

If encountering an "invalid grant" error:

  1. Check Credentials:

    • Verify credentials.json correctness.
  2. Generate New Credentials:

  3. Verify OAuth 2.0 Consent Screen:

    • Ensure proper configuration with required scopes.
  4. Clear Cached Tokens:

    • Delete token.json and re-run the script.
  5. Check System Date and Time:

    • Ensure accuracy; incorrect date/time can affect OAuth token validation.
  6. Verify Internet Connection:

    • Stable internet is required for communication with Google's servers.
  7. Regenerate OAuth Token:

    • Follow on-screen instructions during authentication.

If issues persist, open an issue in this repository.

License

This project is licensed under the MIT License. See LICENSE for details.

About

Gmail Reader is a Go script designed to mark emails as read. Nothing serious, just something I hacked together a couple of months ago to mark all my unread emails as read. I thought it might be useful to someone else, so I decided to share it.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages