6 ms·
I find the title misleading, because this first of all about a new web service the author wants to promote, and not about the elegance of a tiny shell script. (
by vog 9y ago
I find the title misleading, because this first of all about a new web service the author wants to promote, and not about the elegance of a tiny shell script. (At least the article sets this straight in the first paragraph.)
The title suggests that it is all standard Unix tools plus 20 lines shell, and that all you need is a working mail server.
However, that setup requires in addition:
1) a command line tool "wsemail" for email handling, which is ~100 lines of Go code. (by the same author)
2) Cross-Compiling that tool from source for the Raspberry Pi.
And even that tool also doesn't handle email itself, instead it accesses:
3) a separate web service "websocket.email" (by the same author)
4) Requesting an API token for that web service.
If this was really about minimalism (as the title suggests), I would have expected polling a mail account via POP3, or opening a persistent IMAP connection to the mail server, all handled locally by the Raspberry Pi.
- andrewchambers 9y agoThat's a valid interpretation and criticism. I was actually hoping Socat would have a websocket mode to eliminate some steps. My take on it is that you only need to write 20 lines of code to do an email triggered action because I spent some time configuring the tedious parts. At the same time, I thought it would be fun to show people that the real world and linux shell are not so far from interacting with each other.
- vog 9y agoWhy not running an IMAP client on the device? (e.g. fetchmail, or anything else that speaks IMAP) If you spend 100 lines on a separate Go program, you could as well make it a generic IMAP client (using some Go libraries) rather than making it a HTTP/Websocket client that is highly specialiced to a single web service.
- andrewchambers 9y agoThat sounds like a good solution, though I'm using the websocket aspect for throw away addresses in integrations tests where this seemed to make sense.