- Installing rss2email
- Add recipient e-mail address
- Configuring the rss2email
- Configuring SMTP settings to send the email through rss2email
- Using the rss2email
- Scan for new blog posts
- Create a systemd timer for automatic periodic updates
- Commands for troubleshooting
- Example logs of rss2email.service
- Running rss2email on Ubuntu server
I follow a lot of tech blogs and YouTube channels, and I used to subscribe to them all via email. This was convenient, but not all blogs offer email subscription (such as bootlin.com), and some people don’t want to submit their email addresses for privacy reasons.
Most blogs offer RSS or Atom feeds, which allow you to subscribe without giving out your email address. However, you still need a feed aggregator to scan for updates. A good option is to use the rss2email utility, which can deliver all of your blog/Youtube channel updates directly to your inbox. You can even set up rss2email to run as a system daemon, so it will automatically scan for updates at regular intervals.
This post will show you how to install, configure, and run rss2email as a system daemon on Ubuntu. This will allow rss2email to scan for feed updates at regular intervals and deliver them to your inbox.
To install rss2email utility on Debain/Ubuntu based systems, run the following command
sudo apt update && sudo apt install rss2email sendmail
From this point onwards, we will be running commands as the root user. Otherwise, we may encounter problems when configuring rss2email as a daemon later on.
sudo su -
Add recipient e-mail address
This is the e-mail address that will receive all the feed updates from rss2email utility. This step is one time configuration.
r2e new <recipient_mail_id>
Configuring the rss2email
Edit the configuration file $HOME/.config/rss2email.cfg as follows.
In the from field, I use my Gmail address as the sender_mail_id. This is different from the recipient_mail_id mentioned above. Therefore, when there is a blog update, you will receive an email to the recipient_mail_id that appears to have come from the sender_mail_id
from = <sender_email_id> force-form = True to = <recipient_mail_id>
Configuring SMTP settings to send the email through rss2email
Let’s use ssmtp utility to configure SMTP settings on Ubuntu. First, let’s install the sstmp.
sudo apt install ssmtp
Edit the ssmtp configuration file /etc/ssmtp/ssmtp.conf according to your email provider’s SMTP settings. As I have been using Gmail as my sender_mail_id, the configuration looks like the following:
root=<your_gmail_id> mailhub=smtp.gmail.com:587 AuthUser=<your_gmail_id> AuthPass=<gmail_pass or app_pass> UseTLS=YES UseSTARTTLS=YES
If you have two-factor authentication (2FA) enabled for your Gmail account, you may need to create an app password to use with rss2email.
Using the rss2email
Let’s learn how to add a blog feed to rss2email, so it can scan for new blog posts and send you updates in your email.
You can find RSS/Atom feed URL of any blog/YouTube using this guide. Once you get the URL of the feed, use the following command to add it to rss2email.
r2e add <feedName> <feedURL>
Give the feedName a value such as name of the blog. An example is give below.
r2e add NayabSDBlog https://www.nayab.dev/feed.xml
You can add as many feeds as you like using the same command.
Scan for new blog posts
Once you are satisfied with the number of feeds you have added, you can start sending all feed updates to your inbox by running the following command:
Beware that if the feed has many posts, you may receive a lot of emails.
If your RSS feed has a lot of posts, and you don’t want to receive all of them in your inbox, run the following command. This command only needs to be run once per addition of blog feeds. And any subsequent blog/YouTube updates, you will get by running above command.
r2e run --no-send # Just scans but won't send e-mails.
Create a systemd timer for automatic periodic updates
We can use systemd timers to get periodic updates from the rss2email daemon service. To do this, we first need to create a systemd service file that the systemd timer can use.
cat << EOF >> /lib/systemd/system/rss2email.service [Unit] Description=Fetches RSS feeds and send them to email Wants=rss2email.timer [Service] ExecStart=/usr/bin/r2e run [Install] WantedBy=multi-user.target EOF
Enable the rss2email service with the below command. This step is optional as we invoke this service anyways with the systemd timers.
systemctl enable rss2email.service
This creates a symbolic link /etc/systemd/system/multi-user.target.wants/rss2email.service that points to the target file in /lib/systemd/system/rss2email.service. This ensures that the service will be started when the system boots.
Now, let’s write a rss2email.timer file.
cat << EOF >> /lib/systemd/system/rss2email.timer [Unit] Description=calling rss2email peridically Requires=rss2email.service [Timer] Unit=rss2email.service OnCalendar=*-*-* 00/6:00:00 [Install] WantedBy=timers.target EOF
Start and enable the timer with the following commands. Enabling timer will start the service when the system boots.
systemctl start rss2email.timer systemctl enable rss2email.timer
The above rss2email.timer invokes the rss2email.service for every 6 hours. You can see that from the line OnCalendar=*-*-* 00/6:00:00
Once the timer triggers the rss2email service, all the blog and YouTube channel updates that you have enrolled with rss2email will be automatically sent to your inbox.
You can read more about systemd timer here
Commands for troubleshooting
Checking the service/timer status
systemctl status rss2email.service systemctl status rss2email.timer
Checking the service/timer logs
journalctl -u rss2email.service journalctl -u rss2email.timer
You can read more about journalctl here
Commands to start and stop the services
# For rss2email.service systemctl start rss2email.service systemctl stop rss2email.service # For rss2email.timer systemctl start rss2email.timer systemctl stop rss2email.timer
Example logs of rss2email.service
Aug 15 05:39:39 dosing r2e: 2023-08-15 05:39:39,720 [INFO] fetch NayabSDBlog (https://www.nayab.dev/feed.xml -> firstname.lastname@example.org) Aug 15 05:39:39 dosing r2e: 2023-08-15 05:39:39,766 [INFO] process NayabSDBlog (https://www.nayab.dev/feed.xml -> email@example.com) Aug 15 05:39:39 dosing r2e: 2023-08-15 05:39:39,769 [INFO] send message for NayabSDBlog (https://www.nayab.dev/feed.xml -> firstname.lastname@example.org) Aug 15 05:39:39 dosing sSMTP: Creating SSL connection to host Aug 15 05:39:40 dosing sSMTP: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384 Aug 15 05:39:42 dosing sSMTP: Sent mail for root@dosing (221 2.0.0 closing connection p21-20020aa78615000000b00687260020b1sm8792938pfn.72 - gsmtp) uid=0 username=root outbytes=1450 Aug 15 05:39:42 dosing r2e: 2023-08-15 05:39:42,880 [INFO] send message for NayabSDBlog (https://www.nayab.dev/feed.xml -> email@example.com) Aug 15 05:39:42 dosing sSMTP: Creating SSL connection to host Aug 15 05:39:43 dosing sSMTP: SSL connection using ECDHE_RSA_AES_256_GCM_SHA384 Aug 15 05:39:45 dosing sSMTP: Sent mail for root@dosing (221 2.0.0 closing connection k17-20020aa78211000000b0063b898b3502sm8800095pfi.153 - gsmtp) uid=0 username=root outbytes=1298 Aug 15 05:39:45 dosing r2e: 2023-08-15 05:39:45,891 [INFO] send message for NayabSDBlog (https://www.nayab.dev/feed.xml -> firstname.lastname@example.org) Aug 15 05:39:45 dosing sSMTP: Creating SSL connection to host
Running rss2email on Ubuntu server
There are several benefits to running rss2email on a cloud server. First, it is more scalable. If you want to subscribe to a large number of RSS feeds, or if you want to have rss2email scan for updates more frequently, a cloud server will be able to handle the load. Second, it is more reliable. A cloud server is less likely to experience outages than a personal computer.
If you are looking to register for a cloud provider, Digitalocean is great option. You get $200 credit over 60 days period.
https://www.linuxbabe.com/ubuntu/install-use-rss2email-ubuntu-18-04 https://www.freedesktop.org/software/systemd/man/systemd.time.html https://unix.stackexchange.com/questions/126786/systemd-timer-every-15-minutes https://silentlad.com/systemd-timers-oncalendar-(cron)-format-explained