On Thu, Jan 21, 2021 at 9:06 AM Michael Barnes <[email protected]>
wrote:

>
> I need a given script to execute based on what is in
> either the Subject or Body of the email. For example, I send an email to
> [email protected] with something like RESTART_FOO in the Subject or
> Body and it would run the script RESTART_FOO. Another email sent to the
> same address may say RESTART_BAR and execute that script.  From what I
> understand, procmail simply reacts to an incoming email, regardless of what
> is in that email.
>

What MTA are you using? Most of the big ones support directing emails to an
arbitrary executable on the system via the | directive. This is, of course,
terribly insecure so you may have to jump through hoops to enable this
behavior. I had quite an adventure getting it to work in exim, but it does
indeed work.

If the address for this was [email protected], /etc/aliases would contain:

command: "|/usr/local/bin/command-processor"

/opt/command/processor would be a shell script that looks for the key
values like RESTART_whatever and then takes action based on that input.

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

Reply via email to