Skip to content

CLI and Advanced Usage

CLI Mode

💡 Automation Guide: If you want the system to automatically extract emails on a regular basis, we highly recommend using the Schedule tab inside the TUI (it has a built-in pycron that runs in the background automatically when the time comes; no external task scheduler needed). However, if you want to trigger executions from other systems externally (e.g., Linux crontab, Webhooks), or if you need to run tests and one-off data syncing, using the CLI is your best choice.

Use CLI for one-off runs or external integrations:

  • uv tool install mode: run mailslide ...
  • Source mode: run uv run mailslide ...
# default config (source mode)
uv run mailslide

# default config (uv tool install mode)
mailslide

# custom config file
uv run mailslide --config path/to/config.yaml
mailslide --config path/to/config.yaml

# dry run (read only, do not move mails)
uv run mailslide --dry-run
mailslide --dry-run

# write run result to JSON
uv run mailslide --output result.json
mailslide --output result.json

# extract only, do not move mails
uv run mailslide --no-move
mailslide --no-move

Python Import Migration

Use the new import path mailslide for new code:

from mailslide import load_config, LLMClient

Minimal runnable example:

from pathlib import Path

from mailslide import load_config


config = load_config(Path("config/config.yaml"))
print(f"jobs: {len(config.get('jobs', []))}")

The legacy path outlook_mail_extractor is still supported during the compatibility window and will be removed in a future major release.

Localization (gettext + Babel)

The project uses key-based i18n (for example app.title).

  • Runtime: gettext (falls back to outlook_mail_extractor/locales/*.yaml if catalog is not compiled)
  • Development: Babel for po/mo

Temporarily override language in CLI:

uv run mailslide --lang en-US

Or set in config/config.yaml:

ui_language: en-US

Common Babel commands:

pybabel extract -F babel.cfg -o outlook_mail_extractor/locales/gettext/messages.pot .
pybabel init -i outlook_mail_extractor/locales/gettext/messages.pot -d outlook_mail_extractor/locales/gettext -D messages -l zh_TW
pybabel init -i outlook_mail_extractor/locales/gettext/messages.pot -d outlook_mail_extractor/locales/gettext -D messages -l en_US
pybabel update -i outlook_mail_extractor/locales/gettext/messages.pot -d outlook_mail_extractor/locales/gettext -D messages
pybabel compile -d outlook_mail_extractor/locales/gettext -D messages

Windows PowerShell helper script:

./scripts/i18n.ps1 all