4 ms·
Why would a cron job that sends e-mails need to implement its own SMTP client??? You just use the mail program from mailutils or whatever. Just from a point o
by kazinator 2y ago
Why would a cron job that sends e-mails need to implement its own SMTP client???
You just use the mail program from mailutils or whatever.
Just from a point of view of deliverability, developing bare bones SMTP interaction over a socket is a nonstarter. You can't just connect to random mail exchange hosts directly and send mail these days. A solution has to be capable of connecting to a specific SMTP forwarding host (e.g. provided by your ISP). For that, you need to implement connections over TLS, with authentication and all.
Also, a slightly ironic thing is that cron already knows how to send mail. The output of a cron job is mailed to the owner. Some crons let that mail address be overriden with a MAILTO variable in the crontab or some such thing.
- ummonk 2y agoJust another example of Zawinski's law, no?
- onlyrealcuzzo 2y ago> Zawinski's Law captures common market pressure on software solutions, stating that “every program attempts to expand until it can read mail. Those programs which cannot so expand are replaced by ones which can.”
- sjf 2y agoThe modern version would seem to be every platform expands until it includes instant messaging.
- easyThrowaway 2y agoI believe that's outdated already, the next...uh, expansion layer would be some sort of generative AI features. In other words, every other platform expands until it can summarize emails.
- tantalor 2y agoIM is just fancy email.
- partdavid 2y agoThere's actually a lot of things that embed a SMTP client for sending mail that should use a host MTA. The reason is that the user who actually wants to use "the thing" is often just about able to enter an SMTP server, but there's no way "the thing" can trust that a properly-configured sender MTA like sendmail is configured. Companies have huge fleets of servers that can't send system mail, and it's often not really under the control of the author of your frobulator program or the user, either. Mail itself is a specialist configuration, often requiring prerequisites in DNS, crypto stuff, policies, etc. It's "too much" for just being able to have your wallet or whatever send you mail; "contact your system administrator" is just often not a realistic option, in both large and small scales. It's not a good reason, no--definitely not--but it's a real reason.
- leni536 2y agoUse an SMTP library then.
- partdavid 2y agoAgreed, for sure.
- kazinator 2y agoThe SMTP client needs to be configured. E.g. if there is a particular SMTP forwarding host that must be used, you have somehow get the "mail" utility to use that, and you must somehow any get any given SMTP library to also use it.
- bastawhiz 2y agoThere's no universe where I'd trust that there's already some binary on the system to send mail for me, but I definitely wouldn't roll my own. For any reasonable language, there's a multitude of SMTP client libraries available if there's not already one in the stdlib.
- erhaetherth 2y agoI'd give up instantly and outsource it to a SaaS. I'm no expert on email but I know enough to know it's a PITA and managing delivery is a thing, and you have to make sure your DNS is configured right out the receiver will just reject it, there's reputations to consider, you probably want to throttle how fast you send it.. ugh.
- kazinator 2y agoThey are relying on a cron program being there, so ... You can require it and it gets provisioned.