Skip to main content

automated email

Project description

Gmail Automation Bot

A lightweight Python library for creating automated email response systems using Gmail. This bot monitors your Gmail inbox for new messages and responds to them automatically using a custom response function.

Features

  • 🔄 Continuous email monitoring
  • ✨ Automatic responses to new emails
  • 🚫 Built-in filtering for system emails
  • 🔒 Secure authentication using Gmail App Passwords
  • 📝 Customizable response function
  • 🎯 Smart email threading with proper subject prefixing
  • 💫 Beautiful terminal spinner animation during execution

Installation

pip install imaplib email smtplib

Quick Start

from gmaillite import GmailAutomation

def response_func(subject, body):
    # Define your custom response logic here
    response = f"This is an automated response to your email: {body}"
    return response

# Initialize the bot with your credentials
gmail = GmailAutomation(response_func)

# Start the bot
gmail.start()

Configuration Options

GmailAutomation(
    response_func,                          # Your custom response function
    email_address='your.email@gmail.com',   # Gmail address
    app_password='your-app-password'        # Gmail App Password
)

Starting the Bot

# Start with default 2-second check interval
gmail.start()

# Or specify custom check interval (in seconds)
gmail.start(sleep_time=5)

Custom Response Function

The response function receives two parameters:

  • subject: The email subject
  • body: The email body

Example:

def response_func(subject, body):
    if "urgent" in subject.lower():
        return "I'll process your urgent request soon!"
    return f"Thank you for your email about: {subject}"

Features in Detail

Email Filtering

The bot automatically filters out system emails from:

  • noreply addresses
  • Google Community Team
  • Google Play notifications
  • Other automated system notifications

Logging

Built-in logging system with:

  • Info level logging for successful operations
  • Error level logging for issues
  • Debug level logging for system email filtering

Error Handling

Robust error handling for:

  • Email connection issues
  • Authentication problems
  • Message processing errors

Security Notes

  • Never commit your email credentials to version control
  • Always use App Passwords instead of your main Gmail password
  • Consider storing credentials in environment variables

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.

Support

For issues and feature requests, please open an issue on the GitHub repository.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gmaillite-0.2.9.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gmaillite-0.2.9-py2.py3-none-any.whl (4.6 kB view details)

Uploaded Python 2Python 3

File details

Details for the file gmaillite-0.2.9.tar.gz.

File metadata

  • Download URL: gmaillite-0.2.9.tar.gz
  • Upload date:
  • Size: 3.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.0rc1 Linux/6.8.0-49-generic

File hashes

Hashes for gmaillite-0.2.9.tar.gz
Algorithm Hash digest
SHA256 d5b33ee156bbfc4400f1546f9fcb7e237351af00ba3c840b6bf53853b0e6abf5
MD5 aa66bf9bb4ff1b194969f7962a34e600
BLAKE2b-256 3f9fb097b272ab5893494fd89d9e02594c6ec8b3cbfcdaf30af915d1e6fe0513

See more details on using hashes here.

File details

Details for the file gmaillite-0.2.9-py2.py3-none-any.whl.

File metadata

  • Download URL: gmaillite-0.2.9-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.11.0rc1 Linux/6.8.0-49-generic

File hashes

Hashes for gmaillite-0.2.9-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7a135d64c3cd55e6d5d0ba6fcacea689b24136f3af0e15b9715a302172f603a7
MD5 c3262dc08eb5644f6bd3b932b4b166f6
BLAKE2b-256 8e120e9a7e4074803623d7183ae96a04b44d8cba5b9b8918820a61e6976a7d10

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page