On 1/21/21 12:05 PM, Ali Corbin wrote:
On Thu, Jan 21, 2021 at 8:11 AM Michael Barnes <[email protected]>
wrote:

Is there a way to execute a script via email? I have a machine that does
several monitoring tasks of equipment. When certain conditions are detected
and at scheduled times, the machine sends status emails to me. I would like
to send an email back to execute a script to perform tasks.

Is there an easy way to do this?

I  suspect that it's not easy, but I'm sure it's possible, because you can
set up blogger.com to create a post from an email sent to [email protected]
. Unfortunately, the mechanism that actually does it will be on their
servers in a place that's not visible.  Perhaps a google search might
explain how they do this.


There are actually a few more steps in that process. Most web interfaces for blogs or support ticket databases are actually scanning a configured email inbox on a routine basis. Sometimes this is a cron job or other process running as a daemon on the web server. Every time this process scans the inbox, any new emails are parsed and operated on according to various filters.


I set one of these up back in 2019. We configured osTicket to scan our support@ inbox every 60 seconds. Any emails it found would be ingested as tickets in the SQL database and then moved to a "read" box for archival purposes if osTicket went down. Pretty sure that was all just PHP code in osTicket...all I did was click buttons.


Blogs and other web frameworks do all kinds of things in respond to email. Once an email client opens a message it can basically do whatever it wants. By default Thunderbird does every time an email is received. Those notifications you receive in the corner of your screen are typically part of an external program, not your email client.


If your email client can execute 'notify-send "$EMAIL_SUBJECT" "$EMAIL_BODY" ' in response to an email, it can execute any program accessible to the user it runs as. Trying to do this as part of the email server process seems like an excessive amount of work if you ask me.


Sounds like all we need is an email client that supports running arbitrary commands when filtering emails..

-Ben

_______________________________________________
PLUG: https://pdxlinux.org
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to