Sending Emails to Myself
voussoir.net
voussoir.net
Now I am wondering if I can rewrite our B2B product interface to just be email. The more I think about this the more it starts to make a ridiculous amount of sense...
User=>Server (Email 1):
Subject: Get Workflow List
Server=>User (Email 2):
Subject: Workflow List [hash code]
Body: <all workflows by name and id>
User=>Server (Email 3):
Subject: Start Workflow #21
Server=>User (Email 4):
Subject: Workflow #12345532
Body: <First page of onboarding questions the user needs to fill out>
User=>Server (Email 4 - reply):
Subject: Re: Workflow #12345532
Body: <First page of questions with responses>
Server=>User (Email 4 - reply):
Subject: Workflow #12345532
Body: <Second page of questions, or error regarding first page responses>
...
Server=>User (Email 4 - reply):
Subject: Workflow #12345532 [COMPLETED]
Body: <Completion summary with whatever final artifacts attached>
I know our users would totally reject this proposal if it were made to be the only way to interact with our product, but if it were an additional way to interact, they might grow accustomed over time.Think about the technical advantages of the above. If you keep it plaintext, anyone with a computer made within the last 3 decades could access your business system unconditionally. Developer productivity is likely excellent. I can't imagine you would be able to get very distracted with plain text emails.
We use online forms for data capture, but funnily enough things sometimes pan out like you say.
It seems that if you send someone an email saying "You forgot to upload your drivers licence, please click _HERE_ to upload it", a good 50% of the time they will simply reply to your email, attaching the document. And why not really. We used to try again to direct them to the online system, but eventually started handling these things outside the usual flow.
tldr; your idea is sound!
It's the script pulling data over the network, parsing it, developers updating it, etc, where the instability comes in. And don't forget the edge cases where somebody uses weird encoding, a large email with attachments, a client that formats it in weird ways, etc.
I probably took your comment way too seriously.
This is people clicking on mailto: hyperlinks in servicenow notification emails to do stuff like approve/reject a service request or reopen an incident ticket.
You can go beyond this functionality and build any workflow to be triggered after consuming an inbound email sent to client@servicenow.com
I am sure there are a number of email based integrations built using this especially when the upstream application didn't speak API but could do email.
During the rise of J2EE, long before Jespin, we were directed to use JMS. Because architecture. All of the products we tried for our trivial use case would ABEND or break FIFO.
We submitted bug reports, repo steps, and patches to ActiveMQ. Closed, WONTFIX.
So I gave up. Nobody has time for all that.
Motivated by postfix, I just wrote inbound messages to disk. File name included timestamp and counter. fsync() for the win. (What more could we do?)
Processing a queue meant moving a file to a different directory. Logging, archiving, and grooming were just cron jobs and shell scripts. Tada!
Like your predecessor's solution, this allowed trivial testing, observation, and admin.
I wouldn't do this again today for anything high volume. But for less than 100s of messages per minute? Probably.
Years ago I built a little REST API for sending emails to myself. The main advantage is that you don't have to bother setting up a mail server. I still use it constantly for personal projects. It's just the quickest way for me to make my webapp tell me about new user registrations, or for some random Google Apps Script I wrote to let me know about an unexpected condition, or for me to create a bash script that tells me when my VPS is running out of disk space. I've even written scripts to monitor election results or check websites for vaccine availability.
I never did much to promote it, but anyone's welcome to use it as well (website: varmail.me). While I have had almost no downtime, I wouldn't rely on it for something that needs a particular SLA :).
Edit: I forgot to mention another tiny feature that I use all the time. The API lets you specify an idempotence key that will prevent the email from being sent if it's already been used. It's very useful to be able to only send an email the first time a user takes a certain action, or to set it to time()/86400 and only get one disk space reminder email per day. I've found a lot of uses for that.
https://www.varmail.me seems to be down?
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.https://blog.hackertyper.net/post/creating-a-personal-notifi...
With this, I'd create a new bot for each project. Then I could manage the mute on each project individually with ease. Cool!
[0] https://github.com/kylemanna/systemd-utils/tree/master/onfai...
[1] https://www.freedesktop.org/software/systemd/man/systemd.uni...
Thanks for the comments!
At my last job, some of the senior/architect developers had baked in code that would email them with various application statuses. They pointed the logs at their main email addresses for maximum visibility. But what ended up happening is that they let their inboxes get so flooded with email that they simply never bothered to check their email again, including any work-related messages. So to solve that problem, a couple of them just set up keyword filters to auto-forward inbox messages to yet another service that they would check on.
Even now, there's some legacy system that emails all of the developers with some error messages. I think only two out of our 20+ development team even knows what they're for.
Further, if you flood your email server, you can miss logs. And if you hand your project off to someone else, you'd have to figure out if you also want to hand over your email account, or if you want to point the logs to their email account.
tl;dr: email is the wrong solution for logging
I would also dread the idea of multiple people logging into a single email account and triaging things without knowing who read what, or everyone getting their own copy of everything and not knowing what needs doing.
But to know that my monthly backups are working or having trouble, this is working well for me so far!
At small to medium scale, having a mailing list for the dev team which gets emailed when issues come up can be quite handy. It can't be your whole process - someone still needs to take responsibility for actually fixing problems. And you might need to aggressively rate limit it when errors happen. But for the occasional email it can work quite well. Its much easier than building a dashboard.
Eg "[ops] Monthly backup process FAILED", "[ops] Warning: prod4 at 95% RAM usage"
I can't think of anything easier for error-tracking than Sentry, given its ability to automatically intercept exceptions in languages like Python. Sentry also has some automatic handling for stack traces, recording the state of Redis clusters and similar bits of infra, and redacting information that appears to be sensitive (e.g. such as database passwords).
One thing to note is that it's easy to exceed your email provider's quotas with a system like this. For example, Gmail allows a maximum of 3600 emails per hour [1] before incoming mail bounces.
[https://pypi.org/project/twtxt/] not affiliated just thought it was a cool idea with potential for a lot more than just 'microblogging'
Has anybody heard of a rate-limiting SMTP proxy or MTA? I've thought about writing such a thing, but I'd gladly use something already-developed. I'm thinking of a simple token-bucket that uses to/from (or perhaps to/from/subject) to limit duplicate notifications and/or collapse duplicates in a manner similar to a syslog daemon logging "Last message repeated xxx times".
I agree that Postfix config is confusing. It beats the bejabers out of Sendmail config, but that's whataboutism.
Dovecot config isn't that hard, unless you're trying to do hard stuff. Even then, your site config is an overlay on the default config, which should be what you get with your distro. The site-specific stuff is usually ony a couple of dozen lines.
I expect you could also rig Postfix as a rate-limiting front-end for some inferior MTA :-)
[Edit: oh - and Postfix/Dovecot doesn't need a machine to itself, if you're dealing with less than 20-or-so accounts, and you haven't set up a bot to spam the MTA.
Actually, I think there are exactly zero circumstances in which a mailserver shouldn't be kicked-off the machine, in favour of a higher-priority job - email is a best-efforts, store-and-forward system]
But none the less, it's still a great effort by OP. It's awesome when you solve a problem and even more rewarding when you can share your efforts!
Since I do Java code, my guess is to use Spring AOP and create an aspect for this that has a point-cut on an annotation called something like @EmailOnError.
I did some experimenting with async sending and even batching in mine, but decided to remove that and stick with synchronous. The SMTP connection is really fast and most programs send the email at the end of runtime, so it doesn't matter anyway. I prefer the simplicity. I certainly did not want to get into managing an outbound spool, waiting for the server to come back, running a separate daemon for this...
In my_operatornotify I use tenacity to do a couple of retries, then write the message and the fatal exception to a txt file on my desktop or ~/ if there is an error sending the email. I'll notice it eventually. The stuff I'm doing is not important enough to demand more retrying.
Thanks for reading!