| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #!/bin/bash
- # info: delete mail domain antispam support
- # options: user domain
- #
- # The function disable spamassasin for incomming emails.
- #----------------------------------------------------------#
- # Variable&Function #
- #----------------------------------------------------------#
- # Argument defenition
- user=$1
- domain=$(idn -t --quiet -u "$2" )
- domain=$(echo $domain | tr '[:upper:]' '[:lower:]')
- domain_idn=$(idn -t --quiet -a "$domain")
- # Includes
- source $VESTA/conf/vesta.conf
- source $VESTA/func/main.sh
- source $VESTA/func/domain.sh
- #----------------------------------------------------------#
- # Verifications #
- #----------------------------------------------------------#
- check_args '2' "$#" 'user domain'
- validate_format 'user' 'domain'
- is_system_enabled "$MAIL_SYSTEM"
- is_object_valid 'user' 'USER' "$user"
- is_object_unsuspended 'user' 'USER' "$user"
- is_object_valid 'mail' 'DOMAIN' "$domain"
- is_object_unsuspended 'mail' 'DOMAIN' "$domain"
- is_object_value_exist 'mail' 'DOMAIN' "$domain" '$ANTISPAM'
- #----------------------------------------------------------#
- # Action #
- #----------------------------------------------------------#
- # Delete antispam key
- sed -i "/antispam/d" $HOMEDIR/$user/conf/mail/$domain/protection
- #----------------------------------------------------------#
- # Vesta #
- #----------------------------------------------------------#
- # Delete antispam in config
- update_object_value 'mail' 'DOMAIN' "$domain" '$ANTISPAM' 'no'
- # Logging
- log_history "disabled antispam support for $domain"
- log_event "$OK" "$EVENT"
- exit
|