中文 | English
Automated email inquiry processing and quotation generator for e-commerce and custom manufacturing businesses.
- 📥 Automatic Email Fetching - Connect to your mailbox via IMAP and automatically fetch unread inquiry emails
- 🌍 Auto Translation - Detect non-target language emails and automatically translate them
- 💾 Structured Storage - Organize raw emails, extracted text, translated content, and quotations in categorized folders
- 💰 Auto Quotation Calculation - Parse customer requirements and automatically calculate prices based on your pricing rules
- 📝 Professional Quote Templates - Generate ready-to-send quotation replies in both Chinese and English
- ⏰ Scheduled Checking - Run as a background service to periodically check for new emails
email-quote-automation/
├── config/ # Configuration files
│ └── config.py # Main configuration (you need to edit this)
├── scripts/ # Core scripts
│ ├── __init__.py
│ ├── email_check.py # Single check for new emails
│ ├── email_daemon.py # Scheduled background service
│ ├── email_utils.py # Email processing utilities
│ ├── translator.py # Translation module
│ └── quote_calculator.py # Price calculation engine
├── data/ # Your pricing data and examples
│ ├── example/ # Example pricing data
│ │ └── pricing_rules_example.md # Example pricing rules
│ └── README.md # Instructions for placing your data
├── references/ # Template files
│ └── email_template.html # HTML email template
├── email_storage/ # Storage for processed emails (created automatically)
│ ├── raw/ # Original .eml files
│ ├── text/ # Extracted plain text
│ ├── translated/ # Translated content
│ └── quotes/ # Generated quotations
├── requirements.txt # Python dependencies
├── LICENSE
├── README.md # This file (English)
└── README_zh.md # Chinese version
git clone https://github.com/your-username/email-quote-automation.git
cd email-quote-automationpip install -r requirements.txtEdit config/config.py:
- IMAP Settings: Your email server, username and password
- Storage Path: Where to save processed emails
- Translation: Enable/disable translation and choose engine
- Company Info: Your information for quote replies
- Schedule: Check interval in minutes
Replace the example data in data/ with your own pricing rules:
- Create your own pricing rules based on
data/example/pricing_rules_example.md - Update the material and process parameters in
scripts/quote_calculator.pyaccording to your products
See data/README.md for detailed instructions.
Run a manual check to see if everything works:
python scripts/email_check.pypython scripts/email_daemon.pyCommon IMAP server settings:
| Email Provider | IMAP Server | Port | SSL |
|---|---|---|---|
| QQ Mail | imap.qq.com | 993 | Yes |
| 163 NetEase | imap.163.com | 993 | Yes |
| Gmail | imap.gmail.com | 993 | Yes |
| Outlook/Hotmail | imap-mail.outlook.com | 993 | Yes |
Note: Some email providers require you to enable IMAP access and use an app password instead of your regular password.
| Engine | Description | Requires API Key |
|---|---|---|
| google_free | Free Google Translate (via googletrans) | No |
| baidu | Baidu Translation API | Yes |
| none | Disable automatic translation | N/A |
All processed emails are saved in the storage directory you configured (default: ./email_storage):
raw/- Original email files in.emlformat (can be opened in any email client)text/- Extracted plain text content with metadatatranslated/- Translated content (only created if translation is enabled)quotes/- Generated quotation text files ready for sending
-
Customer sends an inquiry email:
"Hi, I need 10 custom crystal medals, 20cm diameter with UV printing and wooden boxes."
-
The tool automatically:
- Fetches the email from your inbox
- Detects it's in English and translates to Chinese
- Parses the requirements: 10 × Crystal 20cm + UV printing + wooden box
- Calculates price:
(120 × 1.0 + 10 + 35) × 10 × 0.95 = ¥1567.50 - Generates a professional quotation reply in both English and Chinese
- Saves everything to the organized directories
- Marks the email as read
-
You just review the generated quote and send it to your customer!
Edit scripts/quote_calculator.py and modify these variables:
MATERIAL_PRICES- Your material base pricesSIZE_COEFFICIENTS- Size-based price coefficientsPROCESS_FEES- Additional process feesDISCOUNTS- Quantity-based discount tiers
Add your engine in scripts/translator.py - see the existing Google and Baidu implementations as reference.
Edit references/email_template.html for custom HTML email templates.
This tool is perfect for:
- 🏆 Medal/Trophy custom manufacturing - (original use case)
- 👕 Custom apparel and merchandise
- 🖨️ Printing and packaging services
- 🪑 Custom furniture and woodworking
- 📦 Light manufacturing and wholesale
- Any business that receives price inquiries via email and has standard pricing rules
- Python 3.7+
pandas- for data handlinglangdetect- for language detectiongoogletrans- for free Google translation (optional)- IMAP-enabled email account
MIT License - see LICENSE for details.
Issues and pull requests are welcome!
(Add your screenshots here after setup)