Created
April 12, 2016 00:54
-
-
Save krispayne/10851e7b302621cfafe1b8a2cffacfb6 to your computer and use it in GitHub Desktop.
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 | |
# gmail message recall | |
# requires Got Your Back https://github.com/jay0lee/got-your-back and a service account. | |
CSV="user-list.csv" | |
MSGID="" # Enter the full message ID here from the "Show Original" in Gmail. Leave out the '<>' | |
GYB="" # location of Got Your Back pythyon script /Users/username/gyb/gyb.py | |
DOMAIN="" # google apps domain e.g. google.com | |
OLDIFS=$IFS | |
IFS=, | |
[ ! -f $CSV ] && { echo "${CSV} file not found"; exit 99; } | |
while read user | |
do | |
echo "Searching for ${MSGID} in ${user}'s mailbox" | |
python3 ${GYB} --service-account --search "rfc822msgid:${MSGID}" --action purge --email ${user}@${DOMAIN} | |
sleep 1 | |
python3 ${GYB} --service-account --search "reference:${MSGID}" --action purge --email ${user}@${DOMAIN} | |
echo "Done. Sleeping 3 seconds..." | |
echo " " | |
sleep 3 | |
done < $CSV | |
IFS=$OLDIFS | |
echo "No more users to search" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
user-list.csv is a list of user's on their own line.