Hi,
I've tried to add new members to the mailing list, but I failed even if I tried 3 ways:
- manage.py shell
- invitation letter
- sending a letter to subscribe.
I try to solve it with the Python shell now. Based on this site: https://docs.mailman3.org/projects/mailman/en/latest/build/lib/mailman/model... I tried this one from Debian bash command line, but there is an error message, as you can see at the end.
# pwd /usr/share/mailman3-web # ./manage.py shell
In [1]: from mailman.interfaces.usermanager import IUserManager
In [2]: from zope.component import getUtility
In [3]: user_manager = getUtility(IUserManager)
ComponentLookupError Traceback (most recent call last) <ipython-input-3-9500ce4250f0> in <module> ----> 1 user_manager = getUtility(IUserManager)
/usr/lib/python3/dist-packages/zope/component/_api.py in getUtility(interface, name, context) 167 if utility is not None: 168 return utility --> 169 raise ComponentLookupError(interface, name) 170 171 def queryUtility(interface, name='', default=None, context=None):
ComponentLookupError: (<InterfaceClass mailman.interfaces.usermanager.IUserManager>, '')
What do I wrong. Should I stop all my mailman processes first?
Thanks, Arpad
On 2022-10-23 16:38, horvath.arpad.szfvar@gmail.com wrote:
Hi,
I've tried to add new members to the mailing list, but I failed even if I tried 3 ways:
- manage.py shell
- invitation letter
- sending a letter to subscribe.
I try to solve it with the Python shell now. Based on this site: https://docs.mailman3.org/projects/mailman/en/latest/build/lib/mailman/model... I tried this one from Debian bash command line, but there is an error message, as you can see at the end. Hi,
we use mailmanclient for that to automatically sync the membership of mailinglists.
import configparser import mailmanclient
mmc = mailmanclient.Client( config[CONFIG_MM_SECTION]['url'], config[CONFIG_MM_SECTION]['user'], config[CONFIG_MM_SECTION]['password'], )
def mailinglist_manage(list_address, members): """ make sure all 'members' are present on the list and not remove everyone else
list_address : mail address of mailing list to manage
addresses : mail addresses that are supposed to be on the list
"""
print("[*] update subscriptions for {}".format(list_address))
ml = mmc.get_list(list_address)
# make sure we dont spam users
ml.settings['send_welcome_message'] = False
ml.settings.save()
addresses = set(members.keys())
ml_members = ml.members
ml_addresses = set((x.address.__str__() for x in ml_members))
for addr in ml_addresses - addresses:
print("unsubscribe {} from {}".format(addr, list_address))
ml.unsubscribe(addr)
for addr in addresses - ml_addresses:
print("subscribe {} to {}".format(addr, list_address))
ml.subscribe(addr, members[addr],
pre_verified=True, pre_confirmed=True,
pre_approved=True)
This should be starting point for your script.
Please be aware that we are using the virtualenv installation type and you seem to use the default debian package so your version of mailmanclient might be different.
Jacob
In my lists there are no big changes. I just need to add one or two persons a year as choir members doesn't change too much.
I try to find out the parameters of the mailmanclient.Client
I guess the URL is the REST root url from the output of the mailman info
command
I tried to add the admin username and the password with which I log into the postorius page. Or the rest admin is a different one?
In [2]: mmc = mailmanclient.Client( ...: "http://localhost:8001/3.1/", ...: "admin", ...: "somepassword", ...: )
In [3]: mmc.get_list('korus')
But that gives me this error
/usr/lib/python3/dist-packages/mailmanclient/client.py in get_list(self, fqdn_listname)
354 :rtype: :class:MailingList
355 """
--> 356 response, content = self._connection.call(
357 'lists/{0}'.format(fqdn_listname))
358 return MailingList(self._connection, content['self_link'], content)
/usr/lib/python3/dist-packages/mailmanclient/restbase/connection.py in call(self, path, data, method) 125 error_msg = response.text 126 --> 127 raise HTTPError(url, response.status_code, 128 error_msg, response, None) 129 if len(response.content) == 0:
HTTPError: HTTP Error 401: REST API authorization failed
Hi All,
From Mark Dale, I've got a suggestion to use mass subscription. I've tried it before without success, but it worked now. I've done it before, but the user from the yahoo.fr domain didn't get the email, we've not found it neither in the normal folder nor in the spam. He is still hanging.
And now this new member wrote to me, that she replied to the email, but it didn't work. But it worked in the end when she tried it next time.
In mailman 2 there was an option to just add users without sending email out and trusting the users to do exactly what they need to do. I miss it very much.
Thanks, Arpad
I've found the solution for adding members fast. I just need to click on the "Pre Verified" checkbox when I use the mass subscription.
participants (2)
-
horvath.arpad.szfvar@gmail.com
-
Jacob Sievert