Integrate firstmail.ltd emails into your Python applications with ease.
- IMAP/POP3 host:
imap.firstmail.ltd - IMAP SSL:
993, POP3 SSL:995 - IMAP non-SSL:
143, POP3 non-SSL:110 - IP:
5.252.35.241
with pip
pip install firstmailwith uv
uv install firstmailbuild from source
git clone https://github.com/nichind/firstmail.git
cd firstmail
pip install -e .Using the context manager (recommended)
from firstmail import firstmail_client
with firstmail_client("[email protected]", "your_password") as client:
# Get the most recent email
last_email = client.get_last_mail()
if last_email:
print(last_email.subject, last_email.sender)
# Get multiple emails (newest first)
emails = client.get_all_mail(limit=10)
print(f"Fetched {len(emails)} emails")Manual resource management
from firstmail import FirstMail
client = FirstMail("[email protected]", "your_password")
try:
print(client.get_message_count())
finally:
client.close()Watch for new emails
from firstmail import firstmail_client
with firstmail_client("[email protected]", "your_password") as client:
for new_email in client.watch_for_new_emails(check_interval=60):
print("New email:", new_email.subject)
# break # optionally exit after the firstNote
If the firstmail command isn't working in your terminal, use python -m firstmail <command>, uv run -m firstmail <command>, etc. instead.
Basic commands
# Read the most recent email
firstmail -e <email> -p <password> read-last
# Read all emails (limit to N)
firstmail -e <email:password> read-all --limit 10 --full
# Watch for new emails
firstmail watch --interval 60 --show-body
# Count messages in inbox
firstmail countYou can also pass credentials explicitly:
firstmail -e [email protected] -p your_password read-lastI'm not responsible for possible misuse of this software. Please use it in accordance with the law and respect the terms of service of the services you access.