Offline computing: RSS feeds So I spent most of my days outside, my laptop under my arm. As part of my job search, my use case alternated between my text editor and my email client. I used to spend a lot of time in my text editor because it was my main work tool during my law studies at university. But spending a lot of time too in my email client was something quite new. Being freshly subscribed to various mailing lists as well as to many newsletters, I saw that I took a lot of pleasure in communicating, reading, and even learning that way. And I started to think that, maybe, I could go a little further. My relationship with content accessible via Internet goes a lot through RSS feeds. I used snownews(1) for a long time, then newsbeuter(1). I've also tried to use online clients but, for reasons already mentioned in previous posts, it never really been my cup of tea. And, one day, I thought that I could perfectly integrate the feeds that I follow into my messaging client of choice, mutt(1). The idea was not necessarily new to me. Indeed, for a few months, I had used a service that allows to subscribe to various RSS feeds from a NNTP gateway--the famous gwene.org. I really liked the experience as I find the use of newsgroups/mails clients really enjoyable. Much more than RSS feed readers. They are many ways to follow RSS feeds via emails but my choice went to rss2email (https://github.com/rss2email/rss2email), a python script originally written by the late Aaron Swartz. My idea was not to launch this tool from my laptop every day before leaving to the Big Whole Outside, but rather to delegate this task to my self-hosted server. In other words, even before I get up, my home server (a tiny Raspberry Pi 3B) would--once a day and by itself thanks to a cron task--collect the additions from my feeds of interest before sending them to the server managing my mailbox. And, for me, nothing would be changed in my morning routine which consists in particular of launching offlineimap(1) to retrieve my emails for the day--mails that would now include my beloved RSS feeds. Yes, each day I'd read the news from, at best, the day before but being offline most of the time, I don't really need to have the last hour update, do I? *** Configuration of rss2mail is very easy. We first need to define some defaults. Here are the interesting part of my rss2email.cfg file: ---8<--- $HOME/.config/rss2email.cfg (snippet) [DEFAULT] from = ME@HOMESERVER.TLD # default from: force-from = True # to avoid errors with some feeds use-8bit = True # we want that name-format = {feed-title} # how From: will look like to = ME@MYMAIL.COM # user mail user-agent = "Usefull UA" html-mail = False # I want plain text mails body-width = 72 # wrap to 72 inline-links = False links-after-each-paragraph = True wrap-links = False date-header = True date-header-order = modified, issued, created, expired use-publisher-email = False feed-timeout = 60 active = True digest = False trust-guid = True trust-link = False encodings = US-ASCII, UTF-8, ISO-8859-1, BIG5, ISO-2022-JP # How new articles will be sent email-protocol = imap sendmail = /usr/sbin/sendmail # for SMTP smtp-auth = True smtp-username = ME@MYMAIL.COM smtp-password = MYPASSWORD smtp-server = MAIL.PROVIDER.NET:587 smtp-ssl = True smtp-ssl-protocol = TLSv1 # for IMAP imap-auth = True imap-username = ME@MYMAIL.COM imap-password = MYPASSWORD imap-server = MAIL.PROVIDER.NET imap-port = 993 imap-ssl = True imap-mailbox = RSS # default folder for article storage --->8--- I guess everything is quite self-explanatory. The important parts are obviously the mail and the IMAP/SMTP configuration. Note too that I want all my email to be UTF-8 plain text, not HTML--rss2email will use html2text/html2markdown to achieve that. Now to add RSS feeds, there's two way for doing it. From the command line: $ r2e add mysupersite https://www.mysuper.site/rss.xml Or by editing rss2email.cfg manually like so: ---8<--- $HOME/.config/rss2email.cfg (example) [feed.supersite] url = https://www.super.site/rss.xml from = mail@super.site imap-mailbox = RSS/Folder1 [feed.ohmyexample] url = https://www.ohmyexample.org/site/allcontent.xml from = contact@ohmyexample.org imap-mailbox = RSS/Folder2 --->8--- As we can see, we define a random name for the feed (here, "supersite" and "ohmyexample"), then we put at least the url of the feed in the appropriate variable. Personally, all my feeds are stored by theme in specific folders created for the occasion ("imap-mailbox" variable). For instance, I have "RSS/News" folder for the newspapers, "RSS/SFFF" folder for all SciFi-Fantasy related articles, or "RSS/Law" folder for everything related to legal monitoring. Plus, when I can find it, I always add the email of the author of the site (the "from" variable). The advantage being that, if I wish to respond an article, I can do so directly since I'm already in my mail client. By pressing "r" in mutt(1) for instance as I do for any other email. mutt(1), or any other mail client for that matter, being then responsible for automatically filling in the Subject field with a "Re: Title of article" and giving me the opportunity to cite the content of the article. It's really very practical. When all is set up, it's as easy as a simple "r2e run" from the command line or in a cron job. (Note that the first time a feed is added, the option "--no-send" can be used to create the local cache without actually sending old articles to the mailbox; all is well explained in the README file in the source tree and/or in the manpage). Finally, here is what a real article looks like in mutt(1) with its full header : ---8<--- example mail generated from microlinux.fr RSS feed MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Le blog technique de Microlinux <info@microlinux.fr> To: f6k@huld.re Subject: Linus Torvalds et Minix Content-Transfer-Encoding: 8bit Date: Sat, 06 Aug 2022 06:02:04 -0000 Message-ID: <843525a4-0a76-7898-b7a4-4b606f9654bf@dev.null.invalid> User-Agent: RSS Reader for huld.re X-RSS-Feed: https://blog.microlinux.fr/feed/ X-RSS-ID: https://blog.microlinux.fr/?p=2834 X-RSS-URL: https://blog.microlinux.fr/linus-torvalds-minix/ X-RSS-TAGS: Formation,Linus Torvalds,Mac OS,Minix,MS-DOS,PC,Unix ![Disquettes Floppy][1] Début janvier 1991 en Finlande, le jeune étudiant Linus Torvalds décide d'investir dans du matériel informatique. Il n'hésite pas à s'endetter sur trois ans pour acheter ce qui se fait de mieux en matière d'ordinateur personnel : un IBM PC 30386 flambant neuf, équipé d'un processeur 32-bits. [1]: https://blog.microlinux.fr/wp-content/uploads/2022/08/floppy-disks.png (...) --->8--- *** As a conclusion, one can think this may perhaps seem superfluous as a procedure: download streams from a device at home, to send them to a remote server, before retrieving them again, but in an other form, from another machine at home. Why not get the news directly from the laptop? One of the reasons for my more and more intensive use of email, and which I have not mentioned yet, is that I actually quite often happen to be outside without having my laptop with me. So that, in these cases, I happen to connect to my provider's webmail application from a computer that is not mine (for instance at my family's, my friends', or even at the public library). So it's quite convenient for me that everything is in one place online. In the same way, it allows me to retrieve all my content from my phone's mail client when I have the chance to come across some Wi-Fi to synchronize with the IMAP server. Again, as with the laptop, a few minutes of downloading are enough; even if I quickly lose Wi-Fi access, I can read the feeds articles whenever I want and wherever I want, as well as my emails, messages on mailing lists, and what's not in my newsletters, as all is stored inside the phone.