Skip to content

Latest commit

 

History

History
88 lines (58 loc) · 2.62 KB

README.md

File metadata and controls

88 lines (58 loc) · 2.62 KB

Email Classification with Gemini

This project represents a system for the automatic classification of incoming emails using Google's Gemini model. It connects to an IMAP server, processes emails, classifies them, and moves them to appropriate folders based on their content.

Donations

If you find this project useful, you can support it through Revolut: https://revolut.me/chuk1.

Dependencies

For proper functioning of the project, the following dependencies need to be installed:

Installing Dependencies

To install the dependencies, use Go Modules.

  1. Initialize Go Modules if not already done:

    go mod init email-classification
  2. Install the required packages:

    go get github.com/BrianLeishman/go-imap
    go get github.com/google/generative-ai-go/genai
    go get google.golang.org/api/option

Setup

  1. Optional: You can create a credentials.json file in the root directory of the project, which will contain your login and password if you wish to save credentials for future use.

    File format:

    {
        "login": "your-email",
        "password": "your-password"
    }
  2. If you don't want to use the credentials.json file, the program will prompt you to enter login and password every time you run it.

  3. Fill in the apiKey variable in the code with your Google Gemini API key.

  4. Modify the IMAP server settings if necessary.

Usage

  1. Run the project with the following command:

    go run main.go
  2. The program will prompt you to enter your login and password, and then it will begin processing emails.

  3. The program will classify emails and move them to appropriate folders.

    Example program output:

    Connecting to IMAP...
    Login successful. Starting email processing...
    Getting folders...
    Folder: INBOX
    Processing email: Hello, World!
    Classifying email... Subject: Hello, World! Senders: sender@example.com
    Email classified as: INBOX
    Email not moved to folder: INBOX
    

Screenshots

Screenshot 1: Screen for saving credentials
remember.png

Screenshot 2: Login screen
login.png

Screenshot 3: Email processing and classification process
result.png