Skip to content
/ gmail-multi-cli Public template

A powerful Python-based CLI tool for managing multiple Gmail accounts. Read, send, and forward emails from your terminal. Featuring a user-friendly interface and secure credential handling.

License

Notifications You must be signed in to change notification settings

davidtkeane/gmail-multi-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gmail Multi-Account CLI

Python License Version

Gmail Multi-Account CLI

A powerful command-line interface for managing multiple Gmail accounts, built with Python.

Table of Contents

Features

  • Manage multiple Gmail accounts from the command line
  • Read, send, and forward emails
  • View new and older emails
  • Colorful and user-friendly interface
  • Secure handling of account credentials

Using App Passwords (Recommended for accounts with 2-Step Verification)

  1. Go to your Google Account's App Passwords page: https://myaccount.google.com/apppasswords
  2. Select "Mail" and "Other (Custom name)" from the dropdowns.
  3. Enter a name for the app (e.g., "Gmail CLI").
  4. Click "Generate".
  5. Use the generated 16-character password in your .env file instead of your regular Gmail password.

Note: Keep this password secret and secure!

For more information or support, please open an issue on the GitHub repository.

  • Manage multiple Gmail accounts from the command line
  • Read, send, and forward emails
  • View new and older emails
  • Colorful and user-friendly interface
  • Secure handling of account credentials

Requirements

  • Python 3.7 or higher
  • pip (Python package installer)

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/gmail-multi-cli.git
    cd gmail-multi-cli
    
  2. Create a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
    
  3. Install the required packages:

    pip install -r requirements.txt
    
  4. Set up your .env file with your Gmail account credentials (see Configuration section).

  5. Run the script:

    python gmail_multi.py
    

Requirements.txt

Create a file named requirements.txt in your project directory with the following content:

python-dotenv==0.19.2
colorama==0.4.4

Using App Passwords (Recommended for accounts with 2-Step Verification)

An app password is a 16-digit passcode that gives a less secure app or device permission to access your Google Account. App passwords can only be used with accounts that have 2-Step Verification turned on.

Create and manage your app passwords. You may need to sign in to your Google Account.

If you’ve set up 2-Step Verification but can’t find the option to add an app password, it might be because:

Tip: Usually, you’ll need to enter an app password once per app or device.

  1. To create an app password, you need 2-Step Verification on your Google Account.
  2. Go to your Google Account's App Passwords page: https://myaccount.google.com/apppasswords
  3. Select "Mail" and "Other (Custom name)" from the dropdowns.
  4. Enter a name for the app (e.g., "Gmail CLI").
  5. Click "Generate".
  6. Use the generated 16-character password in your .env file instead of your regular Gmail password.

Note: Keep this password secret and secure!

Usage

After installation and setup, run the script:

python gmail_multi.py

Follow the on-screen prompts to:

  1. Select an account
  2. Choose an action (read new emails, check older emails, send an email, etc.)
  3. Perform email operations

Configuration

Create a .env file in the project root with your Gmail account credentials:

The app passwrod is 16 letter in lenght with spaces between every 4 lettes, example fejy lpue anye pjeb

So to add the password use this EMAIL_PASS_TheDude=fejy lpue anye pjeb and this format works.

[email protected]
EMAIL_PASS_TheDude=app_password

[email protected]
EMAIL_PASS_Man=app_password

[email protected]
EMAIL_PASS_SpaceMan=app_password

Replace the email addresses and passwords with your actual Gmail credentials.

Troubleshooting

  • Authentication Error: Ensure you've enabled "Less Secure App Access" or are using an App Password.
  • Module Not Found Error: Make sure you've installed all required packages (pip install -r requirements.txt).
  • SMTP Connection Error: Check your internet connection and firewall settings.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Glossary

  • CLI: Command Line Interface - a text-based interface for interacting with a program.
  • IMAP: Internet Message Access Protocol - used for retrieving emails from a server.
  • SMTP: Simple Mail Transfer Protocol - used for sending emails.
  • Virtual Environment: An isolated Python environment that allows you to install packages without affecting your system-wide Python installation.
  • App Password: A 16-character password that gives a less secure app or device permission to access your Google Account.

For more information or support, please open an issue on the GitHub repository.

About

A powerful Python-based CLI tool for managing multiple Gmail accounts. Read, send, and forward emails from your terminal. Featuring a user-friendly interface and secure credential handling.

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages