Batch Add/Remove Users via Mail
Hello Mailman-Users!
I am tasked to write a script that adds multiple users to a mailing list. The List of users is generated from a different database.
Unfortunately, the script will not be running on the same machine as the mailing list is hosted, so as I understand it, I cant use the scripts in "/usr/lib/mailman/bin" (or wherever mailman resides on that machine).
Now I thoght I will just send mailman a mail with lines "subscribe $password address=$address" but it seems like $password is in this case the password for the user of $address.
So in theory I could write "subscribe address=$address", but I have no idea what exactly will happen then. I myself am not administrator on the mailing list, so I can't experiment.
Are the users automatically subscribed to the mailing list, if the mail with the subscribe-statements is sent from a list administrator? How does the administrator authenticate, then? Are all users that get subscribed in that way getting a confirmation mail where they have to approve their subscription? That would be OK, I think. Does the list administrator have to manually approve the subscriptions again, if they are sent with a mail?
Are there better ideas?
Using the Web Interface is not an option (the web interface is used at the moment, but as we need the script anyway to generate the user list, it would be very convenient if the script could also add the new users automatically). If you know of a script (ideally written in perl) that uses some kind of http agent to access the web interface to add/remove users, that would be cool, too.
- Leo Hackstein
Leo Hackstein wrote:
I am tasked to write a script that adds multiple users to a mailing list. The List of users is generated from a different database.
Unfortunately, the script will not be running on the same machine as the mailing list is hosted, so as I understand it, I cant use the scripts in "/usr/lib/mailman/bin" (or wherever mailman resides on that machine).
Correct.
Now I thoght I will just send mailman a mail with lines "subscribe $password address=$address" but it seems like $password is in this case the password for the user of $address.
It is the password to be generated for the newly subscribed user.
So in theory I could write "subscribe address=$address", but I have no idea what exactly will happen then. I myself am not administrator on the mailing list, so I can't experiment.
That is a request to subscribe $address with whatever the digest default is for the list and an autogenerated password. What happens after that is a function of the list's subscribe_policy, but in the most usual cases, it results in a confirmation request email being sent to $address.
Are the users automatically subscribed to the mailing list, if the mail with the subscribe-statements is sent from a list administrator? How does the administrator authenticate, then?
No they are not. There is no list admin authentication available for this process. The subscribe command with address= option is treated the same regardless of who sends it.
Are all users that get subscribed in that way getting a confirmation mail where they have to approve their subscription? That would be OK, I think.
As I indicated above, that's the normal case, but it depends on the list's subscribe_policy.
Does the list administrator have to manually approve the subscriptions again, if they are sent with a mail?
Again, that depends on subscribe_policy. Here are the possiblities for subscribe_policy:
None (only available if ALLOW_OPEN_SUBSCRIBE is set to Yes in mm_cfg.py) - User is subscribed. Confirm - User is send confirmation request and is subscribed upon confirmation Require approval - No mail to user. Owner or Moderator must approve. Confirm and approve - Confirmation email. After confirmation Owner or Moderator must approve.
Are there better ideas?
Using the Web Interface is not an option (the web interface is used at the moment, but as we need the script anyway to generate the user list, it would be very convenient if the script could also add the new users automatically). If you know of a script (ideally written in perl) that uses some kind of http agent to access the web interface to add/remove users, that would be cool, too.
See the latter portion of the FAQ at <http://wiki.list.org/x/uIA9>.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan
On 27/03/2012 21:19, Mark Sapiro wrote:
See the latter portion of the FAQ at <http://wiki.list.org/x/uIA9>. Thank you very much, haven't seen that before. Using wget sounds a bit counterintuitive, but it seems to work.
On Thu, Mar 29, 2012 at 12:51:54PM +0200, Leo Hackstein wrote:
On 27/03/2012 21:19, Mark Sapiro wrote:
See the latter portion of the FAQ at <http://wiki.list.org/x/uIA9>.
Thank you very much, haven't seen that before. Using wget sounds a bit counterintuitive, but it seems to work.
You can do it directly in Perl or Python (or whatever) using modules designed for this (LWP or WWW::Mechanize in Perl, for example). I don't know if there existing tools to do this, but there should be plenty of example code to do similar things.
I know you said that the tool won't run on the same system as Mailman, but if you can open up the database that the list addresses come from and run the script there, this probably would make your life easier. I wrote something in Python recently to sync between LDAP and Mailman, but I do run it on one of the machines that's hooked into our Mailman infrastructure.
w
participants (3)
-
Leo Hackstein
-
Mark Sapiro
-
William Yardley