55 lines
2.4 KiB
Markdown
55 lines
2.4 KiB
Markdown
# mastodon_email_bridge
|
|
|
|
Simple script to forward your Mastodon Home timeline to your email.
|
|
|
|
## Requirements
|
|
|
|
You need to obtain an application token with read access and provide it with the --token parameter.
|
|
|
|
Check the requirements.txt file but the installation should take care of everything.
|
|
|
|
## Installation
|
|
|
|
### Linux
|
|
|
|
```bash
|
|
python -m venv "${HOME}/pyenvs/mastodon_email_bridge"
|
|
source "${HOME}/pyenvs/mastodon_email_bridge/bin/activate"
|
|
pip install .
|
|
mkdir -p "${HOME}/.config/mastodon_email_bridge"
|
|
cp -r templates "${HOME}/.config/mastodon_email_bridge/"
|
|
```
|
|
|
|
## Usage
|
|
|
|
Customize the templates (if you know HTML, CSS and Jinja2) and run the command.
|
|
|
|
```
|
|
Usage: mastodon_email_bridge.py [OPTIONS]
|
|
|
|
Options:
|
|
-d, --debug-level [CRITICAL|ERROR|WARNING|INFO|DEBUG|NOTSET]
|
|
Set the debug level for the standard output.
|
|
-t, --token TEXT Mastodon token with read access. [required]
|
|
-s, --server TEXT Mastodon server full qualified name.
|
|
-L, --limit INTEGER Mastodon token with read access.
|
|
-w, --wait INTEGER Seconds to wait between requests to avoid
|
|
rate limits.
|
|
-r, --recipient TEXT Recipient email to get the posts.
|
|
[required]
|
|
-S, --sender TEXT Sender email thant send the posts.
|
|
-f, --sent-items-file TEXT File to store the IDs of post already sent
|
|
by email.
|
|
-m, --mail-server TEXT SMTP Mail server to send emails.
|
|
-u, --mail-user TEXT Username for SMTP Mail server to send
|
|
emails.
|
|
-P, --mail-pass TEXT User password for SMTP Mail server to send
|
|
emails.
|
|
-p, --mail-server-port INTEGER SMTP Mail server port to send emails.
|
|
-l, --log-file TEXT File to store all debug messages.
|
|
--config FILE Read configuration from FILE.
|
|
--help Show this message and exit.
|
|
```
|
|
## Notes
|
|
- Clean the folder ~/.mastodon_email_bridge_sent_items every now and then, but you can check the generated HTML files to test new templates.
|
|
- The posts that have been sent by email are stored in an SQLite3 database in ~/.mastodon_email_bridge_sent_items.db if you want a post to be sent again you can remove it from there and run again the script.
|