Wrapper script to easily pipe things into BusyBox sendmail
|
Unicorn
823b4beb2d
* Changed all variable names to lower case to make sure there are no conflicts with other shell variables
* changed an invocation of "echo" on user input to "printf" to avoid undefined behaviour from bad input, see https://www.etalabs.net/sh_tricks.html Signed-off-by: Unicorn <unicorn@regrow.earth> |
||
|---|---|---|
| bbmail.sh | * Changed all variable names to lower case to make sure there are no conflicts with other shell variables | |
| README | Initial Commit | |
######################################################################## ########################### BBMAIL ########################### ######################################################################## This shell script takes input through a pipe and sends it via email with some pre-configured settings that can be adjusted in the script itself. It can optionally take one argument, which it uses as a custom subject. bbmail was created to easily send the output of cron-jobs to a pre- configured email address, so this is what it's most useful for. I personally use it to send the output of my servers' daily/weekly maintenance scripts to my email address, just to give you an idea of possible applications. The script only uses POSIX shell features and only depends on BusyBox sendmail and OpenSSL, making it quite portable. The below summary assumes that bbmail.sh is in your $PATH, so if it is not, make sure you write the correct path to the script, for example "./bbmail.sh" if it is in your current working directory. USAGE: command | bbmail.sh ["Custom subject"] EXAMPLES: echo "Hello, world!" | bbmail.sh echo "Hello, world!" | bbmail.sh "My Subject" do_something.sh 2>&1 | bbmail.sh "$(date) script output" For any questions, issues or suggestions you can contact me at unicorn@regrow.earth via email or open an issue in the repository at https://codeberg.org/unicorn/bbmail.sh . The source code is licensed under The MIT License: Copyright © 2021 Edin Taric Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.