Improve send_mail() because it acts more like the logger

* output failure events to stdout if verbose set, useful for those without a mailer
 * do not email if recipient var is undef; allows flexibility for non-releng use cases

Signed-off-by: Nic Boet <nic@boet.cc>
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
This commit is contained in:
Nic Boet 2023-02-27 00:27:02 +01:00 committed by Andreas K. Hüttel
parent f2e3c07e81
commit bdebb3c30e
No known key found for this signature in database
GPG key ID: DC2B16215ED5412A

View file

@ -53,8 +53,14 @@ EOH
}
send_email() {
if [[ ${verbose} -ge 1 ]]; then
echo "$1 $2 build log at $3"
fi
[[ ${nonetwork} == 0 ]] || return
[[ ! -z ${EMAIL_TO} ]] || return
local subject="${EMAIL_SUBJECT_PREPEND} $1"
local message=$2
local logfile=$3