Page 1 of 1

Create RSS feed from email

Posted: 30 Aug 2016, 02:18
by J M L
I'd like to create an RSS feed from incoming email.

Currently I use procmail to sort mail into various mailboxes, and then use gnus to read those mailboxes as if they're newsgroups. This is very 1998.

What I would like to do is use the same procmail sorting, and have procmail do something (send an email, run a script, etc.) which is then handled by something and a full text RSS feed is created from the email. Then I can subscribe to the feeds with TT-RSS, for easy consumption. All I'm finding are external services that I'd forward my email to. I do not want to use an external service (I wouldn't be running TT-RSS if I liked external services).

My dream system is something that I can put an email into, the RSS feed is built, and then it deletes messages as they age out. I don't care if it reads an IMAP folder directly, accepts an incoming email, or picks up files out of a directory.

One suggestion I saw was to run Wordpress, setup posting by email, and then access that feed. That seems like a lot of trouble. Another possibility is to forward things to gmail, resort them there, and use some scripts to create RSS feeds from gmail labels. Another options is to create an NNTP server for the email which then can be accessed over RSS.

Is there a way to do this with using TT-RSS' publish feature?

I'm looking for advice on systems people might have seen or used. My only real requirement is that it have some sort of access control. That can even be as simple as web based authentication to read the feed.

Re: Create RSS feed from email

Posted: 30 Aug 2016, 09:58
by fox
using garbage software like wordpress is not only a massive overkill, it would also introduce about a gazillion security vulnerabilities into the scenario.

tt-rss publish feature makes rss feeds using the article database, since your stuff is not there it's not going to help. i think the easiest way here is a script which would generate feeds based on maildir folders. the only hard part here is mime-decoding the raw email into something readable for which i'm sure there's a library or whatever.

Re: Create RSS feed from email

Posted: 30 Aug 2016, 20:19
by J M L
I should have added :roll: after the Wordpress suggestions, because that's what happened in real life. Stackexchange can be a great resource, but years old questions with a single 0 vote answer :roll: ...

At this time, my best option looks like starting with https://github.com/remko/atomail/, which is a 7 year old project that seems to do exactly what I want. It also looks like the cyrus imap httpd module might work, but that will require switching from dovecot. Switching probably isn't a huge issue, but I've been using dovecot for years without any problem, so I'm hesitant to switch just for fun.

Re: Create RSS feed from email

Posted: 30 Aug 2016, 20:38
by hrk
If you have to start with something, I'd suggest you to use Roundcube Webmail and write a plugin for it. This way you could keep your Dovecot IMAP server. Historically there has been a RSS feature (I see it referred here https://github.com/roundcube/roundcubemail/issues/2302) that has been removed from the main tree. Maybe you can grab its source code at its latest stage and make it work as a plugin.

Re: Create RSS feed from email

Posted: 30 Aug 2016, 20:40
by hrk
FYI: this is the commit which removed the feature, all the code is there. https://github.com/roundcube/roundcubem ... 4a5a47dcd2

Re: Create RSS feed from email

Posted: 30 Aug 2016, 21:42
by fox

Re: Create RSS feed from email

Posted: 30 Aug 2016, 21:51
by J M L
I've already got Roundcube, so that is an idea.

At the moment atamail seems to be working well enough. I like that it's completely user space for handling the message.

So far there are two issues. The first is that it doesn't properly read a Maildir mailbox. It claims it does, but then it crashes because the mailbox directory is not a file. That isn't a big deal, as I don't care about adding old messages to the feed. The feed has to be started with something in order to subscribe, so I just do "atamail.py < Maildir/.lists.stuff/<message>" to seed the feed.

I'm already using procmail, so a simple block like below is enough to do what I want. Then the output is dumped into a web accessible directory, which is protected by basicauth.

Code: Select all

:0 Wi
* ^FROM_DAEMON
{
   :0 c
   $MAILDIR/.lists.daemons/

   :0
   | /usr/local/bin/atomail.py --title 'Daemons' --uri='https://example.com/~user/mail/daemons.xml' --max-time=10080 $HOME/public_html/mail/daemons.xml
}


For html based mail this works well, and the result looks good in tt-rss. Text based mail doesn't look as good, because the text block loses all formatting. That's actual preferable to putting the text in a <pre> or something, because then the lines are too long when viewed on mobile. What I'd like is a text to html conversion that doesn't worry about preserving formatting too tightly, so it is legible on a narrow mobile screen.

The other thing I've discovered is that from about 2001-2006 converting RSS feeds into mailboxes and imap seemed to be a thing people really wanted to do.

Re: Create RSS feed from email

Posted: 30 Aug 2016, 22:55
by fox
rss was in general alive up to about 2006 when everyone finally gave in to google and facebook

Re: Create RSS feed from email

Posted: 31 Aug 2016, 03:12
by pcause
There is a php based solution on github. I have't tried it but someone may want to give it a try and see if it does the job

https://github.com/vekin03/Mail2RSS

Re: Create RSS feed from email

Posted: 31 Aug 2016, 11:26
by fox
well my script is shorter and doesn't require imap :)