fix: call _mail_body and _mail_cmnd directly to make sure that all used variables are exposed

This commit is contained in:
Honza Hommer 2019-05-26 07:03:18 +02:00
parent bbd45c826c
commit 2f41af9cc3
No known key found for this signature in database
GPG Key ID: 5EBDE8E7E1A00ACA

View File

@ -28,13 +28,11 @@ mail_send() {
return 1 return 1
fi fi
_MAIL_BIN=$(_mail_bin) _MAIL_BIN=$(_mail_bin)
_MAIL_CMND=$(_mail_cmnd)
if [ -n "$MAIL_BIN" ]; then if [ -n "$MAIL_BIN" ]; then
_saveaccountconf_mutable MAIL_BIN "$MAIL_BIN" _saveaccountconf_mutable MAIL_BIN "$MAIL_BIN"
else else
_clearaccountconf "MAIL_BIN" _clearaccountconf "MAIL_BIN"
fi fi
_MAIL_BODY=$(_mail_body)
MAIL_FROM="${MAIL_FROM:-$(_readaccountconf_mutable MAIL_FROM)}" MAIL_FROM="${MAIL_FROM:-$(_readaccountconf_mutable MAIL_FROM)}"
if [ -n "$MAIL_FROM" ]; then if [ -n "$MAIL_FROM" ]; then
@ -64,7 +62,7 @@ mail_send() {
contenttype="text/plain; charset=utf-8" contenttype="text/plain; charset=utf-8"
subject="=?UTF-8?B?$(echo "$_subject" | _base64)?=" subject="=?UTF-8?B?$(echo "$_subject" | _base64)?="
result=$({ echo "$_MAIL_BODY" | eval "$_MAIL_CMND"; } 2>&1) result=$({ _mail_body | _mail_cmnd; } 2>&1)
# shellcheck disable=SC2181 # shellcheck disable=SC2181
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then