This project provides a comprehensive solution for email management, including reading and sending emails from Gmail and Outlook accounts, AI-powered context-based replies, and task scheduling using BullMQ.
- AI-Powered Email Categorization and Replies: Automatically categorize emails and generate appropriate responses using OpenAI.
- Email Processing Queue: Efficient task scheduling and email processing using BullMQ.
- Read and Send Emails: Fetch incoming emails from Gmail and Outlook, and send replies based on categorized content.
- Automated Labeling: Assign labels such as "Interested", "Not Interested", or "More Information" based on email content.
- Node.js: Server-side runtime.
- Nodemailer: For sending emails.
- IMAP-Simple: For reading emails.
- BullMQ: Task scheduler and queue management.
- OpenAI API: To generate intelligent replies based on email content.
- Redis: For BullMQ job queue.
- Node.js: Install Node.js.
- Redis: You need to have Redis installed for BullMQ. Install Redis using the following instructions:
- On Linux: sudo apt-get install redis-server
- On Windows: Download and install Redis from here.
 
- On Linux: 
- 
Clone the repository: git clone https://github.com/cchaithanya83/Email-services.git 
- 
Navigate to the project directory: cd Email-services
- 
Install the dependencies: npm install 
- 
Setup environment variables in a .envfile at the root of the project:EMAIL=your_gmail_account APPPASS=your_gmail_app_password OUTLOOK_EMAIL=your_outlook_account OUTLOOK_PASSWORD=your_outlook_password OPENAI_API_KEY=your_openai_api_key 
- 
Start Redis: redis-server 
- Start the application by running:
npm start 
The system automatically categorizes emails into the following labels:
- Interested
- Not Interested
- More Information
It then generates a response based on the email content using OpenAI.
All email tasks are handled by BullMQ, ensuring asynchronous and efficient processing of tasks like reading and sending emails.
- The worker (index.js) processes incoming emails in a loop and uses AI to categorize and reply to them.
- Ensure that Redis is running before you start the worker.
- Run the worker to process queued emails:
node index.js 
- Send an email to the connected Gmail or Outlook account.
- The system will read the email, categorize it, and send an automated reply.
- The entire process is asynchronous, handled via BullMQ and Redis.