diff --git a/bin/vmail-autoresponders-add.sh b/bin/vmail-autoresponders-add.sh index 1c2e60d..662294d 100755 --- a/bin/vmail-autoresponders-add.sh +++ b/bin/vmail-autoresponders-add.sh @@ -23,8 +23,7 @@ help() echo " -o 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 diff --git a/bin/vmail-autoresponders-get.sh b/bin/vmail-autoresponders-get.sh index 8b22e1c..8cc6c49 100755 --- a/bin/vmail-autoresponders-get.sh +++ b/bin/vmail-autoresponders-get.sh @@ -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 diff --git a/bin/vmail-autoresponders-mod.sh b/bin/vmail-autoresponders-mod.sh index 4d6cb04..238cc1d 100755 --- a/bin/vmail-autoresponders-mod.sh +++ b/bin/vmail-autoresponders-mod.sh @@ -23,8 +23,7 @@ help() echo " -o 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'"