On 10/2/25 11:41, Philip Bondi via Mailman-users wrote:
Hello to all:

I've studied the following:

https://docs.mailman3.org/projects/mailman/en/latest/src/mailman/commands/docs/delmembers.html#examples

```bash
mailman shell -l mmlist.domain.ca << EOF | tr , '\012' > nonmember.txt
list(m.nonmembers.members)
EOF
```

I was able to produce a clean list of 50 non-member email addresses that are 
spammers.

How would I take this list of non-members and delete them?  I was unable to use 
mailman delmembers

Assuming you want to delete all the nonmembers, just do it all in mailman shell. Using the above

```bash
mailman shell -l mmlist.domain.ca << EOF
for member in m.nonmembers.members:
    member.unsubscribe()

EOF
```

If your 50 addresses are not all the nonmembers and you only want to delete those 50, the bash script could be

```bash
mailman shell -l mmlist.domain.ca << EOF
for addr in open('nonmember.txt').readlines()
    member = m.nonmembers.get_member(addr.strip())
    member.unsubscribe()

EOF
```

--
Mark Sapiro <[email protected]>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan

_______________________________________________
Mailman-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://lists.mailman3.org/mailman3/lists/mailman-users.mailman3.org/
Archived at: 
https://lists.mailman3.org/archives/list/[email protected]/message/L4UOKTMZ4YULQIUE7IJLEVAYDVDPVL2O/

This message sent to [email protected]

Reply via email to