Skip to Content.
Sympa Menu

en - [sympa-users] RE: Re: How to unsubscribe people from a list from the command line

Subject: The mailing list for listmasters using Sympa

List archive

Chronological Thread  
  • From: "Chris Andrews" <address@concealed>
  • To: "Tim Koop" <address@concealed>, "address@concealed" <address@concealed>
  • Cc: "Olivier Salaün - CRU" <address@concealed>
  • Subject: [sympa-users] RE: Re: How to unsubscribe people from a list from the command line
  • Date: Fri, 27 Apr 2007 11:11:57 -0400

I would recommend just changing the email addresses in the subscribers
table. Each user here at Boston College has up to 7 different email aliases
active at any one time. People often do not have the same reply to address
setup in their different email clients. What I did was write some code so
that every time a user logs into Sympa (only BC users authenticating against
LDAP) I go through and change any subscription that is one of the alternate
aliases to the primary mail attribute that we use for Sympa. Example:

uid: testuser
mailprimary: address@concealed
mailalt: address@concealed
mailalt: address@concealed
mailalt: address@concealed
mailalt: address@concealed

In PERL:

package BCCustomCode;
use lib '/usr/lib/sympa/bin/';

#use strict;
use Log; # This is the Sympa logging facility
use List; # This is the Sympa List pm
use Net::LDAP;
use DBI;

my $dbh = DBI->connect(undef,undef,undef,
{RaiseError => 1});

my $numberofchangedsubscriptions = $dbh->do("UPDATE IGNORE subscriber_table
SET user_subscriber = \"$lookupemail\" where $sqlcheckaltsubscriberfilter
AND include_sources_subscriber is null");

Remember to update the admin table too!

my $numberofchangedadmins = $dbh->do("UPDATE IGNORE admin_table SET
user_admin = \"$lookupemail\" where $sqlcheckaltsubscriberfilter AND
include_sources_admin is null");

$lookupemail = the current primary email address, address@concealed

$sqlcheckaltsubscriberfilter = the SQL filter to find the other email
addresses:

For subscriber table:
( user_subscriber = address@concealed OR user_subscriber =
address@concealed OR user_subscriber = address@concealed )

For admin table:
(user_admin = address@concealed OR user_admin =
address@concealed OR user_admin = address@concealed )

The " AND include_sources_subscriber is null" section make sure that you are
not changing subscriptions for list populated via other sources (LDAP, SQL,
otherlists, etc.)

The IGNORE makes sure that the query does not die if it runs into errors.

You would just need to modify this so that your filter is just the old email
address. You also need to figure out how you are going to trigger this
code. I just run it after a successful bind in the Auth.pm as the user, but
you would need to launch this when the change occurs. I think I need to
write something like this any way as if a user here at BC changes there
userid or becomes an alumni there is a chance that that email address will
not be listed in the mailalt attribute and the subscriptions could become
orphaned.

NOTE - this will not update the admins as listed in the config files for the
list. This might result in some confusion when looking at the owners from
the web UI as it seems to read them from the file instead of the database.
Not sure how to get the config files overwritten to display this info, other
then adding to the script to open and edit the config files my self.

---
 Chris Andrews
 Boston College
 Collaboration Team
________________________________________
From: Tim Koop [mailto:address@concealed]
Sent: Friday, April 27, 2007 11:20 AM
To: address@concealed
Cc: Chris Andrews; Olivier Salaün - CRU
Subject: Re: [sympa-users] Re: How to unsubscribe people from a list from
the command line

Thanks Chris and Olivier.

If the command line is not an option, I don't mind poking into Sympa's
database myself.  Can somebody confirm that a simple delete of a record in
subscriber_table would do the trick, even while Sympa is in the middle of a
mailing?

--
Tim Koop



Chris Andrews wrote:
What about this:
 
The file format is:
 
## Data to be imported
## email gecos
address@concealed John - accountant
address@concealed  Mary - secretary
 
The full name part is optional.
 
The command is:
 
cat <file containing email address> | /var/sympa/sbin/sympa.pl
–import=<list@robot>
 
For example
 
List: testlist
 
Robot: robothost.com
 
File: named emails.txt
 
address@concealed
address@concealed
 
Command:
 
cat emails.txt | /var/sympa/sbin/sympa.pl --address@concealed
 
I found this in the Sympa doc or wiki, I do not remember where.  There was
no delete option mentioned.,
 
---
 Chris Andrews
 Boston College
 Collaboration Team
 
 
-----Original Message-----
From: Olivier Salaün - CRU [mailto:address@concealed]
Sent: Friday, April 27, 2007 5:04 AM
To: Tim Koop
Cc: address@concealed
Subject: [sympa-users] Re: How to unsubscribe people from a list from the
command line
 
No there is no feature to add/remove/edit list members from the
command-line.
 
If you want to write your own tool for manipulating list members, you
should definitely have a loook at the Sympa SOAP interface :
http://www.sympa.org/wiki/manual/soap#sympa_soap_server
 
Tim Koop wrote:
> Is there some way to unsubscribe an email address from a mailing list
> from the command-line?  I've looked in the documentation, but I can't
> find anything anywhere.
> 
> We sometimes have people in our own database who change their email
> addresses, so we need to automatically reflect that change in Sympa
> too.  I can't find a command-line command to change someone's email
> address.  The other way to do it would be to unsubscribe the old
> address and add the new one.
> 
> Is this possible at all?  What are we to do?
 
 

Attachment: smime.p7s
Description: S/MIME cryptographic signature




Archive powered by MHonArc 2.6.19+.

Top of Page