On 2/26/26 13:20, Ibiam Chihurumnaya via Mailman-users wrote:
I'm doing it in
mailman shell, list_name is a List object, and it seems to have asettingsattribute aslist_name.settingsreturns{'acceptable_aliases': [], ...}
I would really like to know what Mailman version this is, and how it was installed? In my case with Mailman core from the head of the GitLab branch:
$ mailman shell -l list.example.com
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
The variable 'm' is the list.example.com mailing list
>>> m.settings
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'MailingList' object has no attribute 'settings'
>>> m.settings['accept_these_nonmembers']
Traceback (most recent call last):
File "<console>", line 1, in <module>
AttributeError: 'MailingList' object has no attribute 'settings'
>>>
Presumably in your case, you could do
list_name.settings['accept_these_nonmembers'].append('user@example.com')
or
list_name.settings['accept_these_nonmembers'].extend(['user1@example.com',
'user2@example.com', 'user3@example.com'])
but as I've said previously, accept_these_nonmembers is not the
preferred way to do this. Something like
$ mailman addmembers --delivery disabled FILE LIST
where FILE contains the addresses to add, one per line and LIST is the list name would add the addresses as members with delivery disabled. To add them as nonmembers with moderation_action Defer:
$ mailman shell -l list.example.com
Welcome to the GNU Mailman shell
Use commit() to commit changes.
Use abort() to discard changes since the last commit.
Exit with ctrl+D does an implicit commit() but exit() does not.
The variable 'm' is the list.example.com mailing list
>>> from mailman.app.membership import add_member
>>> addresses = ('user1@example.com', 'user2@example.com',
... 'user3@example.com')
>>> for addr in addresses:
... rr = RequestRecord(addr)
... nm = add_member(m, rr, role=MemberRole.nonmember)
... nm.moderation_action = Action.defer
...
>>>commit()
Of course, all of this can be done, perhaps more easily, using the Postorius web UI.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan