Skip to main content

Read, send, and reply to Zoho Mail emails on free-tier accounts — no IMAP or POP3 needed

Project description

zohomail-free

PyPI version Python 3.11+ License: MIT

Built by MelkonTech
Documentation · PyPI · GitHub

Read, send, and reply to Zoho Mail emails from Python or the CLI — on a free account.

Zoho locks IMAP/POP3 behind paid plans, so standard email libraries don't work on free accounts. zohomail-free works around this by authenticating via the Zoho web UI and calling their internal API directly — giving you full inbox access and SMTP sending without paying for a plan.

Install

pip install zohomail-free
playwright install chromium

Setup

Create a .env file with your credentials:

ZOHO_EMAIL=you@yourdomain.com
ZOHO_PASSWORD=your_zoho_login_password
ZOHO_REGION=eu   # eu or com

# Optional — only needed if you have 2FA enabled on your Zoho account.
# If not set, ZOHO_PASSWORD is used for SMTP sending instead.
ZOHO_APP_PASSWORD=your_app_specific_password

Python

import asyncio
from zohomail import ZohoMailClient, send

client = ZohoMailClient(
    email="you@yourdomain.com",
    password="your_password",
    region="eu",
)

# List inbox
emails = asyncio.run(client.list_emails(limit=5))
for e in emails:
    print(e["subject"], "—", e["from"])

# Read a full email
email = asyncio.run(client.read_email(emails[0]["id"]))
print(email["body"])

# Send an email
send(
    from_addr="you@yourdomain.com",
    app_password="your_app_password",
    to=["friend@example.com"],
    subject="Hello",
    body="Hi there!",
    region="eu",
)

CLI

# List inbox
zohomail list
zohomail list --limit 20 --json

# Read a message (get the id from list output)
zohomail read --id 1782000221530004400

# Send a new email
zohomail send --to someone@example.com --subject "Hello" --body "Hi there"

# Reply to an email (preserves threading)
zohomail reply --id 1782000221530004400 --body "Thanks!"

AI integration

Helpers in zohomail.ai make it easy to pipe emails into any LLM without extra dependencies:

import asyncio
from openai import OpenAI
from zohomail import ZohoMailClient
from zohomail.ai import emails_to_messages, email_to_prompt

client = ZohoMailClient(email="you@zoho.com", password="...", region="eu")
emails = asyncio.run(client.list_emails(limit=10))

# Summarise inbox with OpenAI
oai = OpenAI()
resp = oai.chat.completions.create(
    model="gpt-4o-mini",
    messages=emails_to_messages(emails, system="Summarise these emails briefly."),
)
print(resp.choices[0].message.content)

# Draft a reply with Claude
import anthropic
email = asyncio.run(client.read_email(emails[0]["id"]))

ac = anthropic.Anthropic()
msg = ac.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=512,
    messages=[{"role": "user", "content": email_to_prompt(email, "Write a short reply:")}],
)
print(msg.content[0].text)

Available helpers: email_to_text, email_to_prompt, emails_to_messages, email_to_tool_result.

How it works

Zoho's free plan blocks IMAP/POP3 with ACCESS_RESTRICTED_BY_ZOHOMAIL. However, their web UI talks to an internal JSON API (ml.do / md.do) over HTTPS. This library uses Playwright to authenticate once, saves the session cookie at ~/.zohomail_session.pkl, then makes API calls from within the browser context — no paid plan needed.

On subsequent runs the saved session is reused. If it expires, the library re-authenticates automatically.

Documentation

Full docs at melkontech.github.io/zohomail-free

Author

Built by MelkonTech

License

MIT — see LICENSE

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

zohomail_free-0.1.5.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

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

zohomail_free-0.1.5-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file zohomail_free-0.1.5.tar.gz.

File metadata

  • Download URL: zohomail_free-0.1.5.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for zohomail_free-0.1.5.tar.gz
Algorithm Hash digest
SHA256 33d28963b5aa081453a407656719778d34ef365dd29e781a236c332c93a8b2eb
MD5 5811ab0cd5605f14ca9a38488d02eafd
BLAKE2b-256 c35402573c7727e858341555496f0af0847a02aa7507cc1c70129317d8eb4205

See more details on using hashes here.

File details

Details for the file zohomail_free-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: zohomail_free-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for zohomail_free-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 817555074c2dfa18b4c827b0a32e11a498c4aecdda9a1eb88591bec71ac4cf18
MD5 f735eeeb98b0e1d0569e66c1f933e03c
BLAKE2b-256 7ee1973d67299ed764b56914410a86b2913186027d32934ac2de0781341645e9

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