thelonelycoder
Part of the Furniture
I'll look into it. As always, I likely do my own implementation that - at best - resembles suggested code.I have a shell library script that I wrote & have used for several years to add the "email notification" feature to other custom scripts I have. It uses AMTM email configuration variables to send the email.
The library script can be downloaded from my GitHub repository:
Bash:mkdir -m 755 -p /jffs/scripts/libs curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/CustomEMailFunctions.lib.sh -o /jffs/scripts/libs/CustomEMailFunctions.lib.sh chmod 755 /jffs/scripts/libs/CustomEMailFunctions.lib.sh
And here's a sample TEST script showing how to use the above library script:
Bash:mkdir -m 755 -p /jffs/scripts/libs curl -kLSs --retry 3 --retry-delay 5 --retry-connrefused https://raw.githubusercontent.com/Martinski4GitHub/CustomMiscUtils/master/EMail/TEST_SendEMailNotification.sh -o /jffs/scripts/libs/TEST_SendEMailNotification.sh chmod 755 /jffs/scripts/libs/TEST_SendEMailNotification.sh
As shown in the TEST script, first the email library script is simply sourced in the script that you want to send emails from. The "_SendEMailNotification_()" function is just an example of how to call the library function using the required parameters: the email subject string & the email body file. If you have the AMTM email config already set up, you can just run the TEST script to send a TEST email to check & verify if it works for you.
You can, of course, modify the TEST script to fit your own specific needs, like making it a callable script to send email notifications.
HTH
I seem to have a questionable coding habit as I hear but that's just how my brain works and how I'm comfortable with. Nothing to worry about. And no offense meant if I do it my own way. I did credit you in the a option in amtm, as you might know - for your recent contribution on GitHub