A powerful web content fetcher and processor
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 subjectbody
: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file gmaillite-0.2.0.tar.gz
.
File metadata
- Download URL: gmaillite-0.2.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e40dac83e5acfba115f550078865c7ae3ec6f0dffa70611e960a9b747eb7b38 |
|
MD5 | 4dd1cbba891e99e2c2f42729246ef5ae |
|
BLAKE2b-256 | bc023fd7ce80f01a798accf4f5af89de33577b909e875ffd7d743170e5ced8d6 |
File details
Details for the file gmaillite-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: gmaillite-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be1c150cf7d994a59d1846f08454caf25a0e3bb672949d5815334075e88b8ea2 |
|
MD5 | 00f22ceb243010aae3822b1879c29c8d |
|
BLAKE2b-256 | 36fe3d9213010cab7c08bc0a19d112f946f75b2a9db4edeb2ccf9464a9ac55dc |