Again this issue would be solved with referential integrity constraints
setup.  When an account is removed all associated data (mailboxes,
aliases, messages, message_blks etc...) would be removed at the same time
without any workarounds and extra code.

> Hi. I have a nice workaround to the unconnect alias issue when deleting
> an account. I use this script to obtain the alias_idnr of the
> unconnected alias and then use a for loop to delete those alias. Just
> add the path to your mysql client if not in your PATH.
>
> Alejandro
>
> #!/bin/sh
> # Clean unconnect aliases
> #
> aliaslist=`/opt/mysql/bin/mysql dbmail -s -e "SELECT  alias_idnr FROM
> aliases LEFT JOIN users ON aliases.deliver_to = users.user_idnr WHERE
> users.user_idnr IS NULL" | grep -v alias_idnr`
>
> for alias in $aliaslist
>    do
>    mysql dbmail -s -e "DELETE FROM aliases WHERE alias_idnr='$alias'"
> done
> _______________________________________________
> Dbmail mailing list
> [email protected]
> https://mailman.fastxs.nl/mailman/listinfo/dbmail



Reply via email to