use base64 for autoresponder body data

This commit is contained in:
Matthew Saunders Brown 2023-11-27 14:48:55 -08:00
parent b263a75471
commit 800ffbff8a
3 changed files with 6 additions and 7 deletions

View File

@ -23,8 +23,7 @@ help()
echo " -o <mode> Mode - either Autoresponder or Vacation. Default is Vacation."
echo " -s <0|1> Status. 0 = disabled/off, 1 = enabled/on. Default is 1."
echo ""
echo " The body must be single quoted and escaped. All single quotes in the body must"
echo " have double back slash like this \\\' and all newlines should be encoded as \n."
echo " The body must be base64 encoded, this is to handle special characters and html entities."
echo " In Vacaion mode only the first email from a specific address is replied to,"
echo " in Autoresponder mode every incoming email, including repeats, get a response."
exit
@ -68,7 +67,7 @@ elif [ "$mbox_id" -gt '0' ]; then
autoresponder_id=`eval $dbcmd $dbcmdopts \"$dbquery\"`
if [[ -z $autoresponder_id ]]; then
# no autoresponder, add new one now
dbquery="INSERT INTO vm_autoresponders SET mbox='$mbox', domain='$domain', subject='$subject', body='$body'"
dbquery="INSERT INTO vm_autoresponders SET mbox='$mbox', domain='$domain', subject='$subject', body=FROM_BASE64('$body')"
if [ ! -z $mode ]; then
dbquery="$dbquery, mode='$mode'"
fi

View File

@ -25,6 +25,7 @@ help()
echo " Search term is optional. If nothing specified all forwards for all email acccounts for all domains will be returned."
echo " Enter email address to get autoresponder info for that email address."
echo " Enter domain name to get all autoresponders for all email addresses under that domain."
echo " Body is returned in base64 encoding, for handling special characters and html entities."
exit
}
@ -39,7 +40,7 @@ if [[ -n $tab ]]; then
fi
# build query
dbquery="SELECT mbox, domain, QUOTE(subject) AS subject, QUOTE(REPLACE(REPLACE(body,'\r\n','\n'),'\n','\\n')) AS body, mode, status FROM vm_autoresponders"
dbquery="SELECT mbox, domain, QUOTE(subject) AS subject, TO_BASE64(body) AS body, mode, status FROM vm_autoresponders"
# set search options
if [[ -n $email ]]; then

View File

@ -23,8 +23,7 @@ help()
echo " -o <mode> Mode - either Autoresponder or Vacation."
echo " -s <0|1> Status. 0 = disabled/off, 1 = enabled/on. Default is 1."
echo ""
echo " The body must be single quoted and escaped. All single quotes in the body must"
echo " have double back slash like this \\\' and all newlines should be encoded as \n."
echo " The body must be base64 encoded, this is to handle special characters and html entities."
echo " In Vacaion mode only the first email from a specific address is replied to,"
echo " in Autoresponder mode every incoming email, including repeats, get a response."
exit
@ -63,7 +62,7 @@ else
dbquery="$dbquery, subject='$subject'"
fi
if [ ! -z "$body" ]; then
dbquery="$dbquery, body='$body'"
dbquery="$dbquery, body=FROM_BASE64('$body')"
fi
if [ ! -z $mode ]; then
dbquery="$dbquery, mode='$mode'"