Get your RSS feeds as email

When it comes too keeping informed about the (IT) world, I tried using Twitter ; and found it to be too noisy. I tried using newsboat ; but it’s not nice when you only have a phone. I tried using Feedly and Scoop.it ; but it often seems slow and redundant ; when not off-topic. Then I tried IFTTT to get my RSS feeds items send by email. And it worked really nice for a month a two. Then suddenly… it stopped working. No error message in the console, no error email, nothing… Strain As A Service…

Then I discovered rss2email. And guess what… it’s available on OpenBSD. So I went for it. Simple and straightforward: configure the RSS feeds and receive the items in your mailbox.

Install the software

rss2email is a Python-based software. But OpenBSD 6.5 takes care of everything.

# doas pkg_add rss2email
(...)
rss2email-2.70:py-html2text-2018.1.9: ok
rss2email-2.70:py-feedparser-5.2.1: ok
rss2email-2.70: ok

There is no man page but a readme.html file is available to learn more about it.

Configuring the software

I already have a bunch of RSS feeds configured. And those can be exported as OPML file from my current tool. And… it can be imported by rss2email. Following the online help, simply create a user database, import the OPML and check it fetches the news.

# r2e new myself@mydomain.com
# r2e opmlimport /tmp/myfeeds.xml
Importing feeds from /tmp/myfeeds.xml
Adding https://www.numerama.com/feed/
(...)
# r2e run --no-send

Copy the default configuration file to your home directory to be able to tune things.

# cp /usr/local/share/examples/rss2email/config.py.example ~/.rss2email/config.py

There is a minimal thing to change: the DEFAULT_FROM value. Set it to something that will not badly bounce in case of errors. Then set SMTP_SEND and/or SMTP_SERVER to configure the way the mails will be sent.

The HTML_MAIL option is there to decide whether you want HTML or TEXT email. There is also a STYLE_SHEET option that allows customizing the HTML format. Here’s an example of one I tried:

STYLE_SHEET='* { font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; color: #353B45; } h1 { font-size: 1.75rem; } a:link { color:     #61AFEF; text-decoration: underline; } blockquote { font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace; } .header, .footer { display:none; } #entry { } #body { font-size: 16px; margi    n-left: 5px; margin-right: 5px; }'

That nearly produced perfect HTML content… There is an issue when reading emails that contains images using the (i)phone. Using a Webmail, it renders ok.

There is a way to hide images (using “#body img { display:none; }“). But I’m not sure HTML format is of any interest if doing so. The other option is to simply ask to TEXT email (HTML_MAIL = 0). In that case, you always get decent emails.

And if you’re a console buddy, it is also rendered properly in textmode.

Automating the polling

Once the configuration is set properly, simply use the crontab to get regular emails.

# crontab -l
# RSS to Emails
*/15  * * * * /usr/local/bin/r2e run 2>&1

And that’s all. Happy readings!

Author: Joel Carnat

Technical Architect and SysAdmin @work ; OpenBSD and FOSS @home ; Karate, Kobudō, Jōdō, Bodyweight workout, Photography @hobby

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.