Skip to content

📧AI assistant for email automation, data retrieval, and managing company records with precision and efficiency.

License

Notifications You must be signed in to change notification settings

maciekmalachowski/SmartMailer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📧SmartMailer

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. License

About The Project

The multi-LLM agent can perform a variety of tasks, including sending personalized emails, querying company data, and managing records such as adding, updating, and deleting company information. It streamlines workflows by leveraging natural language processing to understand and execute tasks with minimal manual intervention.

Key Features:

  • Email Automation: The agent can send emails to one or more companies based on the email addresses stored in the Excel file. It supports both individual and bulk email sending.
  • Data Querying: Users can query the Excel file to retrieve company names, emails, and send status, making data retrieval straightforward and efficient.
  • Record Management: The agent allows users to add new company records, update existing email addresses, or delete records entirely based on company names.
  • Efficient Workflow: Powered by LlamaIndex, the agent ensures personalized interactions with minimal effort, reducing time spent on repetitive tasks.

By using this AI-driven system, users can automate email campaigns, track communication status, and manage their company data without manual entry, all from a simple command-line interface.

(back to top)

Built With

  • OpenAI Powers the agent's reasoning and decision-making capabilities using the GPT-4 Turbo (gpt-4o-mini) model.
  • Ollama A locally hosted LLM leveraging the Llama 3.1 model for efficient querying and analysis of the Excel dataset.
  • Pandas Facilitates data manipulation and management within the Excel file.
  • Smtplib Handles email sending operations via the SMTP protocol.
  • PyYAML Parses email content stored in markdown file for subject and message configuration.
  • dotenv Manages sensitive configuration settings like email credentials via environment variables.
  • LlamaIndex Provides a flexible framework for building the AI-driven agent and enabling natural language interaction with tools and data.

(back to top)

Getting Started

Prerequisites

To use this project, you need to install Ollama and the Llama 3.1 model locally. Follow the steps below:

  1. Install Ollama Locally:

  2. Install the Llama 3.1 Model:

    • After installing Ollama, open a terminal and run the following command to pull the Llama 3.1 model:
      ollama pull llama3.1

Installation

To set up the project locally, follow these steps:

  1. Clone the Repository:

    • Clone this repository to your local machine:
      git clone [email protected]:maciekmalachowski/SmartMailer.git
      cd SmartMailer
  2. Create a Virtual Environment:

    • Create a virtual environment for the project:
      python -m venv ai_venv
    • Activate the virtual environment:
      • On Windows:
        ai_venv\Scripts\activate
      • On macOS/Linux:
        source ai_venv/bin/activate
  3. Install Dependencies:

    • Install the required dependencies from requirements.txt:
      pip install -r requirements.txt
  4. Create a .env File:

    • In the root of the project, create a .env file with the following environment variables:

      EMAIL = "[email protected]"
      PASSWORD = "examplepass"
      OPENAI_API_KEY = "exampleCZS5njczXqSBlOfavoO-iHOovT3BlbkFJwcWvyftM7ltRSS8Pkby8zGO4HK4TV8iJf4-fsuuNxayHUkmVPtBuFDUfvPq0czDInnsNWh_eEA"
      
    • Google App Passwords: If you are using a Google account and have 2-factor authentication enabled, you may need to generate an App Password for this project. You can read more about creating App Passwords here.

    • Optional (but recommended): If you have limited space on your main disk, you can specify the location for caching the Ollama models by adding the following variable to the .env file:

      OLLAMA_MODELS = "D:\Example\ollama_models"
      

      This will redirect Ollama's model cache to the specified location.

Once these steps are completed, the environment will be ready to run the project!

(back to top)

Usage

To use this AI-driven email agent, follow the steps below:

  1. Activate the Virtual Environment:

    • Before running the agent, make sure to activate the virtual environment:
      • On Windows:
        ai_venv\Scripts\activate
      • On macOS/Linux:
        source ai_venv/bin/activate
  2. Run the Agent:

    • Once the environment is activated, you can start the agent by running:
      python agent.py
    • This will load the agent, and you will be prompted to enter commands.
  3. Example Prompts:

    You can interact with the agent by typing different prompts. Here are some examples:

  • Query the Excel file:
    • Retrieve all company names and emails:
      Retrieve all company names and emails.
      

  • Add a new record:
    • Add a company with name and email:
      Add company named example1 with email [email protected].
      

  • Delete a record:
    • Delete a company record based on the company name:
      Delete company named example1.
      

  • Update a record:
    • Update the email for a specific company:
      Update email for company named example1 to [email protected].
      

  • Send an email:
    • Send an email to a company name listed in the Excel file:
      Send email to company named example1.
      

  • Check sent emails:
    • Query the status of emails that have been sent:
      Which emails have been sent?
      

  1. Excel File Structure:

    The Excel file (company_data.xlsx) used by the agent contains the following columns:

    • Company_name: The name of the company.
    • Company_email: The email address of the company.
    • Send_status: A field that tracks the status of the email sent to the company (e.g., sent, pending).
  2. Updating Email Title and Subject:

    You can easily customize the email's Subject and Message by updating the email.md markdown file. This file contains the following structure:

     ---
     Subject: "TEST SUBJECT"
     Message: "TEST MESSAGE"
     ---

    Simply replace "TEST SUBJECT" and "TEST MESSAGE" with the desired email title and content. These changes will be reflected in the emails the agent sends.

Simply enter the prompts, and the agent will perform the corresponding actions like querying, adding, deleting, updating records, or sending emails.

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

About

📧AI assistant for email automation, data retrieval, and managing company records with precision and efficiency.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages