add filter option to mboxes
This commit is contained in:
parent
074264942a
commit
c55e2644a8
|
@ -13,13 +13,14 @@ help()
|
|||
echo "$thisfilename"
|
||||
echo "Add email account to vmail system"
|
||||
echo ""
|
||||
echo "usage: $thisfilename -e <email> -p <password> [-q <quota>] [-s <0|1>] [-h]"
|
||||
echo "usage: $thisfilename -e <email> -p <password> [-q <quota>] [-s <0|1>] [-j <0|1|2>] [-h]"
|
||||
echo ""
|
||||
echo " -h Print this help."
|
||||
echo " -e <email> Email address to add."
|
||||
echo " -p <password> Unencrypted Password for new email address."
|
||||
echo " -q <quota> Set mailbox quota in GB, otherwise default for this domain is used. NULL means no limit."
|
||||
echo " -s <0|1> Status. 1 for enabled, 0 for disabled. Default is in db structure and is normally set to 1."
|
||||
echo " -j <0|1|2> Filter Junk/Spam messages. 0 = not filtering. 1 = filter Junk only. 2 = filter Junk & Spam. Default is 2."
|
||||
}
|
||||
|
||||
vmail:getoptions "$@"
|
||||
|
@ -53,6 +54,9 @@ if [ "$rowcount" -eq '0' ] ; then
|
|||
if [[ -n $status ]] ; then
|
||||
dbcmd="$dbcmd, status=\"$status\""
|
||||
fi
|
||||
if [[ -n $filter ]] ; then
|
||||
dbcmd="$dbcmd, filter=\"$filter\""
|
||||
fi
|
||||
if [ -z "$quota" ] ; then
|
||||
# get mbox_quota_default from domains table
|
||||
quota=`mysql --defaults-extra-file=$MYSQL_CONNECTION_INFO_FILE -s -r -N -e "SELECT mbox_quota_default from vm_domains WHERE domain='$domain';"`
|
||||
|
|
|
@ -20,6 +20,7 @@ help()
|
|||
echo " -p <password> Set new password."
|
||||
echo " -q <quota> Set mailbox quota in GB, otherwise default for this domain is used. NULL means no limit."
|
||||
echo " -s <0|1> 1 for enabled, 0 for disabled. Default is in db structure and is normally set to 1."
|
||||
echo " -j <0|1|2> Filter Junk/Spam message. 0 = not filtering. 1 = filter Junk only. 2 = filter Junk & Spam. Default is 2."
|
||||
exit
|
||||
}
|
||||
|
||||
|
@ -71,6 +72,14 @@ if [ ! -z "$status" ]; then
|
|||
dbset="$dbset status=\"$status\""
|
||||
fi
|
||||
|
||||
# check for junk filter update
|
||||
if [ ! -z "$filter" ]; then
|
||||
if [ ! -z "$dbset" ]; then
|
||||
dbset="$dbset,"
|
||||
fi
|
||||
dbset="$dbset filter=\"$filter\""
|
||||
fi
|
||||
|
||||
if [ -n "$dbset" ]; then
|
||||
|
||||
# build query
|
||||
|
|
|
@ -85,7 +85,7 @@ function vmail::yesno() {
|
|||
|
||||
function vmail:getoptions () {
|
||||
local OPTIND
|
||||
while getopts "ha:b:d:e:f:gcp:q:s:tk:f:gl:m:vx" opt ; do
|
||||
while getopts "ha:b:d:e:f:gj:cp:q:s:tk:gl:m:vx" opt ; do
|
||||
case "${opt}" in
|
||||
h ) # display help and exit
|
||||
help
|
||||
|
@ -159,6 +159,9 @@ function vmail:getoptions () {
|
|||
g ) # glob (wildcard) search
|
||||
glob=${OPTARG,,}
|
||||
;;
|
||||
j ) # Filter Junk
|
||||
filter=${OPTARG}
|
||||
;;
|
||||
k ) # keep
|
||||
keep=${OPTARG}
|
||||
if [[ $keep != "0" ]] && [[ $keep != "1" ]]; then
|
||||
|
|
|
@ -179,6 +179,7 @@ CREATE TABLE IF NOT EXISTS `vm_mboxes` (
|
|||
`passwd` char(128) NOT NULL,
|
||||
`status` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`quota` int(10) UNSIGNED DEFAULT NULL,
|
||||
`filter` tinyint(1) NOT NULL DEFAULT 2,
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `email` (`domain_id`,`mbox`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
|
|
Loading…
Reference in New Issue
Block a user