How to Install and Use rss2email on Ubuntu

This tutorial will be showing you how to install and use rss2email on Ubuntu. Rss2email is an open-source program that can send RSS feed update to your email address. RSS feed is great way to keep updated with blogs and websites, but some site owners allow certain amount of articles in the RSS feed and others set a time limit. RSS feed readers don’t save articles on your computer, so you will miss some articles from time to time. Wouldn’t it be nice if you can store all articles in a mailbox so you never miss a blog post? That’s where rss2email comes in. I also prefer to read blog posts in my email client rather than reading the article on a website.

Note: This tutorial works on all current versions of Ubuntu, including Ubuntu 18.04, 20.04 and 20.10.

Install and Configure rss2email on Ubuntu

Rss2email is in the default Ubuntu software repository, so you can easily install it by executing the following command in a terminal window.

sudo apt install rss2email

rss2email

The binary will be installed as /usr/bin/r2e.  Once installed, you need to create a new feed database with the command below, which will set a default email address that mails are sent to. It’s recommended that you use a dedicated email address for your RSS feeds.

r2e new [email protected]

Next, you can export your RSS feed subscriptions from your feed reader to an OPML file and import it to r2e feed database.

r2e opmlimport file.opml

Some web-based feed reader may give you an XML file. You can also import it too.

r2e opmlimport file.xml

Then you can list your feeds with:

r2e list

To add a new feed, run

r2e add feedname http://feed.url/somewhere.rss

If you want to send the feed to a different email address than the default email address, run

r2e add feedname http://feed.url/somehwere.rss [email protected]

Now you can edit the configuration file. I will use the Nano command line text editor.

nano ~/.config/rss2email.cfg

The default from address is [email protected], you probably want to change that.

from = [email protected]

By default, rss2email will use the email address found in the feed as the from address when there’s an email address in the feed. This causes bounced email sent to the email address in the feed, effectively creating the backscatter problem. To disable this behavior, use force-from = True.

force-from = True

Next, you need to add a target email address.

to = [email protected]

If you want to receive email in HTML format, then change the following values to True.

html-mail = False
use-css = False

rss2email ubuntu

Save and close this file. To save a file in Nano text editor, press Ctrl+O, then press Enter to confirm. To close the file, press Ctrl+X.

Configure SMTP

Then we need to configure how rss2email sends email. By default, r2e uses sendmail binary to send email if it exists on the system. If you installed rss2email on your Postfix mail server, then you can skip this part. If you installed rss2email on your local computer, then you can use SMTP to send email. Although rss2email allows you to configure SMTP in ~/.config/rss2mail.cfg file, the implementation is quite buggy actually.

Instead, we can use sSMTP to configure SMTP.  sSMTP is very simple SMTP server. First, install ssmtp on Ubuntu.

sudo apt install ssmtp

Then open the configuration file.

sudo nano /etc/ssmtp/ssmtp.conf

Edit the file like below.

root=[email protected]
mailhub=smtp.gmail.com:587
AuthUser=[email protected]
AuthPass=YourGmailPassword
UseTLS=YES
UseSTARTTLS=YES

Note that if you enabled two-step verification for your Gmail account, you will need to use an App password instead of the normal password.

I use Gmail SMTP server for r2e to send email in this example. You can use other email services as well.

Save and close the file. Now you can run the following command to test the SMTP configurations.

echo "hello" | sendmail [email protected]

If SMTP configurations are correct, you will receive an email from your Gmail account.

If you see this following error while running the above command.

sendmail: Server didn't like our AUTH LOGIN (535 5.7.8 Error: authentication failed: Invalid authentication mechanism)

It’s because your SMTP server doesn’t support the LOGIN authentication mechanism.

Using Postfix to Relay Email

Postfix is a full-blown and very popular SMTP server. You can use Postfix to relay email through Gmail instead of using sSMTP. If you installed sSMTP before, remove it.

sudo apt purge ssmtp

Then install Postfix on Ubuntu.

sudo apt install postfix

When you see the following message, press the Tab key and press Enter.

install rss2email ubuntu

Then choose the third option: Internet with smarthost, because we want Postfix to send email via another SMTP server such as Gmail.

rss2email ubuntu18.04

Next, set the system mail name. I just use the default value because it doesn’t matter.

send rss feed to email

Finally, enter the SMTP server address. If you use Gmail, enter smtp.gmail.com:587.

blogtrottr alternative

After Postfix is installed, open the configuration file.

sudo nano /etc/postfix/main.cf

Add the following lines to the end of this file.

# outbound relay configurations
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = static:[email protected]:YourPassword
smtp_sasl_security_options = noanonymous
smtp_tls_security_level = may
header_size_limit = 4096000

Save and close the file. Then restart Postfix for the changes to take effect.

sudo systemctl restart postfix

Now you can run the following command to test the SMTP configurations.

echo "hello" | sendmail [email protected]

If SMTP configurations are correct, you will receive an email from your Gmail account.

Polling RSS Feeds

After SMTP is configured, you can poll all your feeds by running the following commands.

r2e run --no-send

This command is run only once because rss2email will poll all articles in the feed database. You probably don’t want to receive articles you have already read, hence the --no-send option. If you have a lot of feeds in the database, then this process can take some time. After this command completes its task, you need to run the following command to receive new articles from your RSS feeds.

r2e run

Creating A Cron Job

Instead of manually executing r2e run every time, you can use Cron to automate this task. Open your crontab file.

crontab -e

Put the following line into this file.

*/20 * * * * /usr/bin/r2e run > /dev/null 2>&1

This will run r2e every 20 minutes. To run r2e every 30 minutes, just change 20 to 30.

*/30 * * * * /usr/bin/r2e run > /dev/null 2>&1

Save and close the file.

More usage

To export RSS feeds from the database, run

r2e opmlexport > file.opml

To temporarily pause a feed, run

r2e pause feed-index

To unpause a feed run

r2e unpause feed-index

To get the feed index number, run

r2e list

For example, to pause pause feed #10, run

r2e pause 10

If you want to change the recipient email address of a particular RSS feed, then edit the ~/.config/rss2email.cfg file. You will find each RSS feed name and URL at the bottom of this file. To override the default recipient email address, simply add a to = parameter like below.

[feed.name]
url = https://example.com
to = [email protected]

How to Find a Website’s Feed URL in Firefox

Google Chrome stopped supporting RSS feed a long time ago. Some sites doesn’t show their RSS feed URL to visitors. You can press Ctrl + I in Firefox to find them.

best rss to email service

Find the Feed URL of YouTube Channel

Every YouTube channel has a feed URL, the format of which is:

https://www.youtube.com/feeds/videos.xml?channel_id=<channel_id>

You can use this YouTube Channel ID finder tool.

Troubleshooting

If rss2email isn’t working properly, you can use the -VVV flag to show debug information.

r2e -VVV run

For example, r2e shows me the following error message.

2021-07-04 10:40:25,973 [ERROR] error while running time limited function: generator raised StopIteration
2021-07-04 10:40:25,973 [ERROR] cause: generator raised StopIteration

It turns out that this error only happens when it’s fetching RSS feeds from a FeedBurner URL.

I hope this tutorial helped you install and use rss2email on Ubuntu. Take care.

Rate this tutorial
[Total: 7 Average: 4.6]

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here