Skip to content

Newsboat Sendmail - A companion script that sends unread RSS items in Newsboat through email

License

Notifications You must be signed in to change notification settings

lenormf/newsboat-sendmail

Repository files navigation

newsboat-sendmail

newsboat-sendmail is a script that sends all unread RSS items in the user’s Newsboat database to a given email address, and marks them as read.

It doesn’t cache any data, synchronises nicely with Newsboat (lock-file support), lets a sendmail-compatible utility handle sending email (no handling of credentials), and is fairly extensively configurable through an INI configuration file and/or command-line options.

Do not use this tool without backing up your Newsboat database (cache.db) beforehand!

Dependencies

  • Python3

  • BeautifulSoup4: to extract links out of HTML formatted RSS items and into a list

You can setup a virtual environment and install the above dependencies within it with the following commands:

$ python3 -mvenv .env
$ source .env/bin/activate
$ pip3 install -r requirements.txt

Configuration

To store configuration settings on disk, create file sendmail.cfg in the same directory as Newsboat's config. Depending on your setup, that directory might be ~/.newsboat or $XDG_CONFIG_HOME/newsboat ($XDG_CONFIG_HOME defaults to ~/.config if unset).

The configuration file is written in the INI format, and follows the same rules described in the Python documentation. Note that interpolations are not enabled during parsing.

Refer to the example sendmail.cfg for more information about the format of the file and supported values.

If you’re not interested in storing settings, command-line options can be passed to the script directly. Command-line options override the ones loaded from the configuration file (if any).

Run the following command to learn more about the command-line options:

$ ./newsboat-sendmail.py -h

Usage

The only information the script requires is what addresses to send the emails to.

You might want to tweak what utility is used to actually send the emails (e.g. msmtp), what template the emails will use (e.g. plaintext) etc. in which case, refer to the "Configuration" section above.

Either way, you can verify your settings by using the "dry run" mode, which will not modify the Newsboat database or send any emails - only print the commands that would be run. Combine it with the "debug" mode to tweak your configuration further:

# Update the Newsboat database to get some unread items in
$ newsboat -x reload
# Debug, dry run - append your custom CLI options
$ ./newsboat-sendmail.py -d -n
# Everything looks good, send the emails!
$ ./newsboat-sendmail.py

About

Newsboat Sendmail - A companion script that sends unread RSS items in Newsboat through email

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published