Cybrkyd's Git Repositories

mail2x

Branch: main Last commit: 2026-02-07 13:30:10 +0000 Clone: git clone https://git.cybrkyd.com/repository/mail2x

mail2x

A small Python script that posts tweets based on incoming emails. Any unread email with the subject mail2x is processed. The email body becomes the tweet text, and a single attached image (if present) is uploaded and included in the tweet.

Requirements

Setup

Edit the script and fill in your Twitter API keys and email IMAP credentials:

API_KEY = '...'
API_SECRET_KEY = '...'
ACCESS_TOKEN = '...'
ACCESS_TOKEN_SECRET = '...'

IMAP_SERVER = '...'
EMAIL_USER = '...'
EMAIL_PASSWORD = '...'

Install dependencies:

pip install requests requests_oauthlib

Usage

Manual Execution

Make the script executable and run it:

chmod +x mail2x.py
python3 mail2x.py

Automation via Crontab

To automate the script, add an entry to crontab. For example, to run it at five minutes-past every hour:

5 */1 * * * /usr/bin/python3 /path/to/mail2x.py

Notes

Licence

This project is made available under a GPL3 licence -- see COPYING for the full text.