From dee8d6f1b826bb25eaf206a1eea49c96412187ee Mon Sep 17 00:00:00 2001 From: Benjamin Sonntag Date: Sat, 12 Aug 2017 16:54:31 +0200 Subject: [PATCH] delete alias too when deleting pop/imap accounts, fixes #165 --- src/update_mails.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/update_mails.sh b/src/update_mails.sh index 80385cff..1ee68a83 100755 --- a/src/update_mails.sh +++ b/src/update_mails.sh @@ -66,8 +66,10 @@ mysql_query "SELECT id, address_id, quote(replace(path,'!','\\!')) FROM mailbox done # List the adresses to DELETE +# delete aliases of this pop/imap email too : +mysql_query "DELETE r FROM recipient r LEFT JOIN address a ON r.address_id = a.id WHERE a.mail_action = 'DELETE' OR a.mail_action = 'DELETING';" # Delete if only if there isn't any mailbox refering to it -mysql_query "delete a FROM address a LEFT JOIN mailbox m ON a.id = m.address_id WHERE m.id IS NULL AND (a.mail_action = 'DELETE' OR a.mail_action = 'DELETING');" +mysql_query "DELETE a FROM address a LEFT JOIN mailbox m ON a.id = m.address_id WHERE m.id IS NULL AND (a.mail_action = 'DELETE' OR a.mail_action = 'DELETING');" # Delete the lock rm -f "$LOCK_FILE"