If I manually add email addresses to a list and then delete them, how do i permanent delete them from Users?
I added some email addresses manually to a mailing list and then removed them. But now I can't find how to totally remove them from mailman3. They show up in the Users list.
When I go to the Django interface, I don't see them listed in any selection. I thought they would show up under Emails in Hyperkitty, but they are not there.
Oddly, somehow I've managed to create multiple duplicates of the same address, under Emails. Figure that one out! Thanks. - Mark
21 mrl@psfc.mit.edu April 25, 2023, 4:54 a.m. [Mark] afasdfa mark.lists1.psfc.mit.edu 20 mailman@psfc.mit.edu April 25, 2023, 4:44 a.m. [Mark] Re: tet mark.lists1.psfc.mit.edu 19 london@mit.edu April 25, 2023, 4:31 a.m. [Mark] tet mark.lists1.psfc.mit.edu 18 mrl@psfc.mit.edu April 25, 2023, 3:28 a.m. [Mark] test mark.lists1.psfc.mit.edu 17 mailman@psfc.mit.edu April 25, 2023, 3:27 a.m. [Mark] tet mark.lists1.psfc.mit.edu 16 mailman@psfc.mit.edu April 25, 2023, 3:22 a.m. [Mark] Re: foobar mark.lists1.psfc.mit.edu 15 mrl@psfc.mit.edu April 25, 2023, 3:21 a.m. [Mark] test mark.lists1.psfc.mit.edu 14 mrl@psfc.mit.edu April 25, 2023, 2:05 a.m. [Mark] ;jklj mark.lists1.psfc.mit.edu 13 mrl@psfc.mit.edu April 25, 2023, 1:53 a.m. [Mark] foobar mark.lists1.psfc.mit.edu 12 mrl@psfc.mit.edu April 25, 2023, 1:52 a.m. [Mark] test mark.lists1.psfc.mit.edu 11 mailman@psfc.mit.edu April 25, 2023, 1:51 a.m. [Mark] Re: test mark.lists1.psfc.mit.edu 10 mrl@psfc.mit.edu April 25, 2023, 1:42 a.m. [Mark] test mark.lists1.psfc.mit.edu 9 mrl@psfc.mit.edu April 25, 2023, 1:38 a.m. [Mark] test mark.lists1.psfc.mit.edu 8 mrl@psfc.mit.edu April 25, 2023, 1:40 a.m. [Mark] test mark.lists1.psfc.mit.edu 7 mailman@psfc.mit.edu April 25, 2023, 1:33 a.m. [Mark] foobar mark.lists1.psfc.mit.edu 6 mailman@psfc.mit.edu April 25, 2023, 1:32 a.m. [Mark] test mark.lists1.psfc.mit.edu 5 root@psfc.mit.edu April 25, 2023, 1:21 a.m. [Mark] foobar mark.lists1.psfc.mit.edu 4 root@psfc.mit.edu April 25, 2023, 1:20 a.m. [Mark] test mark.lists1.psfc.mit.edu 3 root@psfc.mit.edu April 25, 2023, 1:11 a.m. [Mark] test mark.lists1.psfc.mit.edu 2 root@psfc.mit.edu April 25, 2023, 1:14 a.m. [Mark] test mark.lists1.psfc.mit.edu 1 mailman@psfc.mit.edu April 25, 2023, 1:22 a.m. [Mark] test mark.lists1.psfc.mit.edu
On Tue, Apr 25, 2023 at 12:21 PM Mark London via Mailman-users < mailman-users@mailman3.org> wrote:
I added some email addresses manually to a mailing list and then removed them. But now I can't find how to totally remove them from mailman3. They show up in the Users list.
You can delete them from the command line:
su - mailman
for m in cat file_containing_the_addresses_one-per_line
; do
mailman delmembers -m $m -l listane@domain;
done
When I go to the Django interface, I don't see them listed in any
selection. I thought they would show up under Emails in Hyperkitty, but they are not there.
Does your SITE_ID in the Django interface (it's shown under Domains) match the SITE_ID in settings?
-- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", egrep -v '^$|^.*#' ¯\_(ツ)_/¯ :-) [How to ask smart questions: http://www.catb.org/~esr/faqs/smart-questions.html]
Mark London wrote:
I added some email addresses manually to a mailing list and then removed them. But now I can't find how to totally remove them from mailman3. They show up in the Users list.
You may find this script useful: https://www.msapiro.net/scripts/clean_users.py
I have it running in a cronjob. Thread discussing the script can be found here:
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/G...
TLDR you end up with orphaned Django users both from when users subscribe/unsubscribe and due to spam signups using the Postorius form which never get confirmed.
Thanks. Andrew.
On 4/25/23 3:02 AM, Andrew Hodgson wrote:
Mark London wrote:
I added some email addresses manually to a mailing list and then removed them. But now I can't find how to totally remove them from mailman3. They show up in the Users list.
You may find this script useful: https://www.msapiro.net/scripts/clean_users.py
That script will only delete Django users and optionally the Mailman user corresponding to the deleted Django user. I think the OP wants to delete Mailman users that are not members of any lists even if there is no corresponding Django user. That script won't do that.
Mailman Users can be deleted from the Postorius Users view, but it's a
one at a time process, and there's no indication that the User has
memberships unless you first go to Manage
to check.
I will modify the script to enable deleting Mailman users with no memberships even if they aren't Django users and post here when it's done.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On 4/25/23 6:59 AM, Mark Sapiro wrote:
On 4/25/23 3:02 AM, Andrew Hodgson wrote:
You may find this script useful: https://www.msapiro.net/scripts/clean_users.py
I will modify the script to enable deleting Mailman users with no memberships even if they aren't Django users and post here when it's done.
The script at https://www.msapiro.net/scripts/clean_users.py has been updated. As before, it has settings to control whether Django users are deleted if there is a corresponding Mailman user with no memberships or only if there is no corresponding Mailman user, and whether or not Mailman users with no memberships are deleted.
The difference is when deleting Mailman users it will now delete Mailman users with no memberships whether or not there is a corresponding Django user.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Mark Sapiro wrote:
The script at https://www.msapiro.net/scripts/clean_users.py has been updated. As before, it has settings to control whether Django users are deleted if there is a corresponding Mailman user with no memberships or only if there is no corresponding Mailman user, and whether or not Mailman users with no >memberships are deleted.
Thanks, I ran this script and it did delete a load of Mailman users, I got output similar to this: <User "" (47600399411039288509336192576257642185) at 0x7fb17a6a35e0> deleted from Mailman
Why aren't we seeing the actual address here?
Thanks. Andrew.
/ I saw output like:/
<User "Real Name1" (250400693957149667060114911620088407125) at 0x7f9435096640> deleted from Mailman <User "Real Name2" (52978839424924170731978420609240089133) at 0x7f9435096760> deleted from Mailman
So your users had no real names configured?
Cheers, Eggert
Am Dienstag, 25. April 2023, 23:14:27 CEST schrieb Andrew Hodgson:
Mark Sapiro wrote:
The script at https://www.msapiro.net/scripts/clean_users.py has been updated. As before, it has settings to control whether Django users are deleted if there is a corresponding Mailman user with no memberships or only if there is no corresponding Mailman user, and whether or not Mailman users with no >memberships are deleted. Thanks, I ran this script and it did delete a load of Mailman users, I got output similar to this: <User "" (47600399411039288509336192576257642185) at 0x7fb17a6a35e0> deleted from Mailman
Why aren't we seeing the actual address here?
Thanks. Andrew.
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/ Archived at: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message /BTJUT6FGNGK5ARADPD6VW37VMHQG2GWJ/
This message sent to eggert@eehmke.de
Mailman's content filtering has removed the following MIME parts from this message.
Replaced multipart/alternative part with first alternative.
Eggert Ehmke wrote:
I saw output like:
<User "Real Name1" (250400693957149667060114911620088407125) at 0x7f9435096640> deleted from Mailman <User "Real Name2" (52978839424924170731978420609240089133) at 0x7f9435096760> deleted from Mailman
So your users had no real names configured?
Yep same here, I just picked a user without a name configured for privacy reasons. Actually most users didn't have a name configured.
Thanks.
Andrew.
On 4/25/23 2:14 PM, Andrew Hodgson wrote:
Mark Sapiro wrote:
The script at https://www.msapiro.net/scripts/clean_users.py has been updated. As before, it has settings to control whether Django users are deleted if there is a corresponding Mailman user with no memberships or only if there is no corresponding Mailman user, and whether or not Mailman users with no >memberships are deleted.
Thanks, I ran this script and it did delete a load of Mailman users, I got output similar to this: <User "" (47600399411039288509336192576257642185) at 0x7fb17a6a35e0> deleted from Mailman
Why aren't we seeing the actual address here?
That was a choice I made. you could change
with transaction():
user_manager.delete_user(mm_user)
print(f'{mm_user} deleted from Mailman')
to
with transaction():
try:
email = user.preferred_address.email
except AttributeError:
email = 'no_preferred_address'
user_manager.delete_user(mm_user)
print(f'{email} deleted from Mailman')
to display the email address from the user's preferred_address if the user has one. All users should have one, but I've seen cases where there isn't one.
It could also be
email = user.addresses[0].email
which might be better.
In the above case, the empty string, "", is the user's display_name which in this case is empty, and the number in parentheses is the UUID of the user expressed as a decimal integer which isn't really useful. My thought was the display_name was as useful as anything, but obviously not if it's empty.
I actually started with the preferred_address.email code above, but in testing, I got the 'no_preferred_address' result with the one deleted user so I, perhaps erroneously, went with the representation of the user. I'll probably update the script again.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On 4/25/23 2:44 PM, Mark Sapiro wrote:
On 4/25/23 2:14 PM, Andrew Hodgson wrote:
Why aren't we seeing the actual address here?
...
I actually started with the preferred_address.email code above, but in testing, I got the 'no_preferred_address' result with the one deleted user so I, perhaps erroneously, went with the representation of the user. I'll probably update the script again.
I have updated the script again. It now displays:
User: "Junk Mail" <junk_mail@example.com> deleted from Mailman
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
Andrew - The script had:
DELETE_MAILMAN_USER = False
When I set it to True, it got rid of the orphaned email addresses. Thanks! - Mark
On 4/25/2023 6:02 AM, Andrew Hodgson wrote:
Mark London wrote:
I added some email addresses manually to a mailing list and then removed them. But now I can't find how to totally remove them from mailman3. They show up in the Users list. You may find this script useful: https://www.msapiro.net/scripts/clean_users.py
I have it running in a cronjob. Thread discussing the script can be found here:
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread/G...
TLDR you end up with orphaned Django users both from when users subscribe/unsubscribe and due to spam signups using the Postorius form which never get confirmed.
Thanks. Andrew.
Works for me too! Thank you.
Only the path to python is #! /opt/mailman/venv/bin/python
In my installation.
Cheers, Eggert
Am Dienstag, 25. April 2023, 22:51:52 CEST schrieb Mark London via Mailman-users:
Andrew - The script had:
DELETE_MAILMAN_USER = False
When I set it to True, it got rid of the orphaned email addresses. Thanks! - Mark
On 4/25/2023 6:02 AM, Andrew Hodgson wrote:
Mark London wrote:
I added some email addresses manually to a mailing list and then removed them. But now I can't find how to totally remove them from mailman3. They show up in the Users list.
You may find this script useful: https://www.msapiro.net/scripts/clean_users.py
I have it running in a cronjob. Thread discussing the script can be found here:
https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/thread /GH4K42T66FU5PBHJH6ZDQEIUTXVDSLOC/
TLDR you end up with orphaned Django users both from when users subscribe/unsubscribe and due to spam signups using the Postorius form which never get confirmed.
Thanks. Andrew.
Mailman-users mailing list -- mailman-users@mailman3.org To unsubscribe send an email to mailman-users-leave@mailman3.org https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/ Archived at: https://lists.mailman3.org/archives/list/mailman-users@mailman3.org/message /K3PO2XMCDR2342GVPHEQJNZPVPEPY6R4/
This message sent to eggert@eehmke.de
Mailman's content filtering has removed the following MIME parts from this message.
Replaced multipart/alternative part with first alternative.
participants (5)
-
Andrew Hodgson
-
Eggert Ehmke
-
Mark London
-
Mark Sapiro
-
Odhiambo Washington