Last active
May 26, 2021 22:11
-
-
Save LuisCardenasSolis/b681edb359fcd889daaf6015bccbb301 to your computer and use it in GitHub Desktop.
Limpiar Buzones y eliminar contactos no deseados
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
USERS=$( /opt/zimbra/bin/zmprov -l gaa | grep -Ev 'spam\.|ham\.|virus-quarantine\.|galsync') | |
for account in $USERS | |
do | |
echo -n "Purging ${account} : " | |
/opt/zimbra/bin/zmmailbox -z -m ${account} emptyFolder /Trash | |
/opt/zimbra/bin/zmmailbox -z -m ${account} emptyFolder /Drafts | |
/opt/zimbra/bin/zmmailbox -z -m ${account} emptyFolder /Junk | |
echo "...done" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN="domain.com" | |
USERS=$( /opt/zimbra/bin/zmprov -l gaa | grep -Ev 'spam\.|ham\.|virus-quarantine\.|galsync\.') | |
for user in $USERS; do | |
echo -n "Clean $user : " | |
IDS=$(/opt/zimbra/bin/zmmailbox -z -m $user gact | grep -E "^Id: |email.*@${DOMAIN}$" | grep email -B1 | grep Id | awk -F": " '{print $2}') | |
echo -n '('$IDS')' | |
for id in $IDS; do | |
/opt/zimbra/bin/zmmailbox -z -m $user dct $id | |
done | |
echo " ...Done" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment