FAQ
Hello,

I've been using Mailman for a while now for a single, low-traffic,
low-membership list. I'm now launching a service that's going to use
mailman for quite a few more low-traffic, low-membership lists, and I'm
trying to set up some customizations for the membership and
administrative interfaces. This is going to be fairly tightly integrated
with a web site that uses a MySQL database to store a bunch of
membership information. So now I've done a bit of digging, and figured
out how to modify the templates and mailing list defaults, but there's
a couple of things I'm still trying to figure out:

1. I've seen some references to a way of managing users in a SQL
database. Is this implemented yet? I haven't been able to find anything
explaining how to go about doing it. Since my users are already going to
have an entry in a SQL database, I thought it would be great to combine
the site password for a user with the mailman password, and make the
whole thing less confusing.

2. I can't figure out how to get default text that uses a variable into
the list at creation time. I'd like the description to have a specific
short sentence that includes the %(real_name)s variable, but I don't
know much about Python, and it doesn't seem to work. Can I put this
variable in the description text, and have it expand correctly?


I have a few other ideas for web sites that might use different default
configurations of Mailman. So here's a few questions related to this:

3. Can you customize default information/templates for a single virtual
domain? It appears that changing the Mailman/templates/* affects the
entire site. Is there a way to have different default templates, based
on the virtual host? Probably simpler--what Python syntax would I use to
add custom default variables to the mm_cfg.py file, and where would I
start to dig to find where the templates are loaded, so I could hack in
some conditional path changes?

4. I'm confused about the ADMIN_CATEGORIES variable. I redefined it in
mm_cfg.py (to remove some of the categories for list admins--I'm trying
to make this whole thing very simple for my users), and it changed the
menu site-wide. I'm thinking, if I knew the basic conditional construct
for Python, I could just redefine it for specific domains. Is there any
function set up to do this already, or something else I should consider
before doing so?

Guess I'm answering some of my own questions here. I know nothing about
Python--maybe I'll go read up on it a bit first. But if somebody could
give me an answer for #1, I'd appreciate it, and if there's any short
cuts I should look at for the others, it'd be great!

I do have virtual domains working just fine, otherwise...

Thanks,
John Locke
http://www.freelock.com
Just launched: http://teamcheckin.com



________________________________________________________________________

Search Discussions

  • John Locke at Feb 4, 2003 at 4:00 am
    Nothing but silence... Let me simplify & rephrase my questions:

    1. Is there any support for storing member information in a SQL
    database, with MM 2.1?


    2. Is there any way to customize lists on a per-virtual-domain basis?
    Something as simple as having a different mm_cfg.py, and a different
    templates/ directory for each domain would be what I'm looking for--but
    can't quite get it to work.


    Thanks,
    --
    John Locke
    http://freelock.com
    Just launched: http://teamcheckin.com


    On Sun, 2003-02-02 at 17:47, John Locke wrote:

    1. I've seen some references to a way of managing users in a SQL
    database. Is this implemented yet? I haven't been able to find anything
    explaining how to go about doing it. Since my users are already going to
    have an entry in a SQL database, I thought it would be great to combine
    the site password for a user with the mailman password, and make the
    whole thing less confusing.
    I have a few other ideas for web sites that might use different default
    configurations of Mailman. So here's a few questions related to this:

    3. Can you customize default information/templates for a single virtual
    domain? It appears that changing the Mailman/templates/* affects the
    entire site. Is there a way to have different default templates, based
    on the virtual host? Probably simpler--what Python syntax would I use to
    add custom default variables to the mm_cfg.py file, and where would I
    start to dig to find where the templates are loaded, so I could hack in
    some conditional path changes?
  • Simon White at Feb 4, 2003 at 8:40 am

    03-Feb-03 at 20:00, John Locke (mail at freelock.com) wrote :
    Nothing but silence... Let me simplify & rephrase my questions:

    1. Is there any support for storing member information in a SQL
    database, with MM 2.1?
    I do this via synchronisation. A script that calls
    add_member/remove_member called from the code that does the
    INSERT/DELETE query in SQL. It's not particularly robust but it works.

    Ideally having an external DB for Mailman would solve many a problem for
    me, since I have 12000 subscribers in one DB for web access to certain
    "member" parts of a website, and a synchronisation with Mailman's
    internal DB for the list membership.

    Now, it's not 100% critical if someone unsubscribes on the web but
    doesn't get removed from the mailing list, but if Mailman could just
    sync with the SQL DB that would be ideal.
    2. Is there any way to customize lists on a per-virtual-domain basis?
    Something as simple as having a different mm_cfg.py, and a different
    templates/ directory for each domain would be what I'm looking for--but
    can't quite get it to work.
    I don't know if this is fully possible, but I know each list can have
    it's own language preference so I guess there are other parameters each
    list can have uniquely.

    --
    -Simon White, Internet Services Manager, Certified Check Point CCSA.
    -MTDS Internet, Security, Anti-Virus, Linux and Hosting Solutions.
    -MTDS 14, rue du 16 novembre, Agdal, Rabat, Morocco.
    -MTDS tel +212.3.767.4861 - fax +212.3.767.4863
  • John Locke at Feb 4, 2003 at 5:09 pm

    On Tue, 2003-02-04 at 00:40, Simon White wrote:
    03-Feb-03 at 20:00, John Locke (mail at freelock.com) wrote :
    1. Is there any support for storing member information in a SQL
    database, with MM 2.1?
    I do this via synchronisation. A script that calls
    add_member/remove_member called from the code that does the
    INSERT/DELETE query in SQL. It's not particularly robust but it works.
    Yes, this is what I was thinking I would have to do. I had just found
    some references to a SQL "member adapter" for Mailman, during a web
    search, but was unable to find anything about implementing it.

    The biggest issue is that my web server is separate from my mail server
    (both are running MySQL, but for reliability, I'm having the web site
    hosted). So I'm gonna have to develop some sort of replication
    /synchronization scheme to handle connection outages...

    2. Is there any way to customize lists on a per-virtual-domain basis?
    Something as simple as having a different mm_cfg.py, and a different
    templates/ directory for each domain would be what I'm looking for--but
    can't quite get it to work.
    I don't know if this is fully possible, but I know each list can have
    it's own language preference so I guess there are other parameters each
    list can have uniquely.
    So far I've been able to set per-list configurations, using config_list
    after the list is created. I found if I create an "en/" directory inside
    the directory for the list, any templates I put in there are used before
    the ones in the main template directory. But this doesn't help for the
    initial list-creation email sent to the list admin (because the list
    isn't created beforehand), or for the ADMIN_CATEGORIES variable (because
    it seems to be site-wide).

    Any other ideas?

    Thanks,
  • Todd at Feb 4, 2003 at 5:25 pm

    John Locke wrote:
    On Tue, 2003-02-04 at 00:40, Simon White wrote:
    I do this via synchronisation. A script that calls
    add_member/remove_member called from the code that does the
    INSERT/DELETE query in SQL. It's not particularly robust but it works.
    Yes, this is what I was thinking I would have to do. I had just found some
    references to a SQL "member adapter" for Mailman, during a web search, but
    was unable to find anything about implementing it.
    I haven't seen anyone announce a MySQLMemberAdaptor yet either, but Martin
    Whinnery made an announcement here a few weeks ago for an LDAPMemberAdaptor.
    If you know some python, perhaps you want to look at the LDAP version and
    try and convert it for use with MySQL. You'd surely make a lot of friends if
    you did it. :)

    The URL for the LDAPMemberAdaptor is http://webserver.offal.homelinux.org

    You might also want to look at ~mailman/Mailman/MemberAdaptor.py if you're
    thinking of attempting this.
    So far I've been able to set per-list configurations, using config_list
    after the list is created. I found if I create an "en/" directory inside
    the directory for the list, any templates I put in there are used before
    the ones in the main template directory. But this doesn't help for the
    initial list-creation email sent to the list admin (because the list isn't
    created beforehand), or for the ADMIN_CATEGORIES variable (because it
    seems to be site-wide).
    You might already know this, but here's what the very helpful comments in
    Mailman.Utils.maketext say:

    # When looking for a template in a specific language, there are 4 places
    # that are searched, in this order:
    #
    # 1. the list-specific language directory
    # lists/<listname>/<language>
    #
    # 2. the domain-specific language directory
    # templates/<list.host_name>/<language>
    #
    # 3. the site-wide language directory
    # templates/site/<language>
    #
    # 4. the global default language directory
    # templates/<language>
    #
    # The first match found stops the search. In this way, you can
    # specialize
    # templates at the desired level, or, if you use only the default
    # templates, you don't need to change anything. You should never modify
    # files in the templates/<language> subdirectory, since Mailman will
    # overwrite these when you upgrade. That's what the templates/site
    # language directories are for.

    Perhaps the second option is what you're looking for?

    - --
    Todd OpenPGP -> KeyID: 0xD654075A | URL: www.pobox.com/~tmz/pgp
    ===========================================================================Never underestimate the power of very stupid people in large groups.
  • John Locke at Feb 4, 2003 at 7:16 pm

    On Tue, 2003-02-04 at 09:25, Todd wrote:

    I haven't seen anyone announce a MySQLMemberAdaptor yet either, but
    Martin
    Whinnery made an announcement here a few weeks ago for an
    LDAPMemberAdaptor.
    If you know some python, perhaps you want to look at the LDAP version
    and
    try and convert it for use with MySQL. You'd surely make a lot of
    friends if
    you did it. :)

    The URL for the LDAPMemberAdaptor is
    http://webserver.offal.homelinux.org

    You might also want to look at ~mailman/Mailman/MemberAdaptor.py if
    you're
    thinking of attempting this.
    Thanks for the note. I don't know any Python, but maybe I'll take a
    whack at it if I find the time...
    You might already know this, but here's what the very helpful comments in
    Mailman.Utils.maketext say:

    # When looking for a template in a specific language, there are 4 places
    # that are searched, in this order:
    #
    # 1. the list-specific language directory
    # lists/<listname>/<language>
    #
    # 2. the domain-specific language directory
    # templates/<list.host_name>/<language>
    #
    # 3. the site-wide language directory
    # templates/site/<language>
    #
    # 4. the global default language directory
    # templates/<language>
    #
    # The first match found stops the search. In this way, you can
    # specialize
    # templates at the desired level, or, if you use only the default
    # templates, you don't need to change anything. You should never modify
    # files in the templates/<language> subdirectory, since Mailman will
    # overwrite these when you upgrade. That's what the templates/site
    # language directories are for.

    Perhaps the second option is what you're looking for?
    Ah, that solves half of my problem! Thanks a lot. No, I hadn't found
    this text, anywhere.

    Any suggestions for the last part--having different default options for
    different domains in mm_cfg.py? It would be great if I could just have a
    different mm_cfg.py for each domain. Alternatively, is there code I
    could put into mm_cfg.py that would recognize what domain we're in, and
    set different defaults accordingly?

    Thanks,
    John
  • Df at Feb 5, 2003 at 3:01 pm
    Hello

    I've been reading Simon's post regarding the possible mailman users > mysql synchronisation.

    In a website we develop (www.urbanshadows.com), we propose to our users to subscribe to a mailman mailling list;
    We also propose the users to choose beetween a different list of topics.
    Those users login/passwd/prefered_topics are stored in a mysql database.

    According to one of Simons post i understood their might be a way to synch the users..

    Now my question would be, aside adding/deleting users, could we also specify witch topics the users choosed ?
    Is there a binary intended to modify mailman's user topic settings ?
    Otherwise some file of some sort that could be parsed/edited to modify those settings ?

    Final note, i don't know i can ask you this Simon, but do you think you can paste us your script to synch mailman > mysql ..?
    (would understand if you prefer to keep it private).

    Anyways ,

    Best regards.

    df.
  • Simon White at Feb 5, 2003 at 3:29 pm

    05-Feb-03 at 16:01, df at dune.org (df at dune.org) wrote :
    I've been reading Simon's post regarding the possible mailman users >
    mysql synchronisation.

    In a website we develop (www.urbanshadows.com), we propose to our
    users to subscribe to a mailman mailling list; We also propose the
    users to choose beetween a different list of topics.
    Those users login/passwd/prefered_topics are stored in a mysql database.

    According to one of Simons post i understood their might be a way to synch the users..

    Now my question would be, aside adding/deleting users, could we also
    specify witch topics the users choosed ? Is there a binary intended
    to modify mailman's user topic settings ?
    Otherwise some file of some sort that could be parsed/edited to modify
    those settings ?

    Final note, i don't know i can ask you this Simon, but do you think
    you can paste us your script to synch mailman > mysql ..? (would
    understand if you prefer to keep it private).
    Hi

    Well first of all it works MS-SQL-> Mailman. Not MySQL.

    So, it's in ASP (but would be trivial to convert to PHP/MySQL)

    Here's the gory dirty hack details:-

    - A page is called in ASP which contains POST data comprising an email
    address either for subscription/unsubscription.
    - This script updates the DB which itself has a field recevoirLettreInfo
    which is true if subscribed, otherwise false (people may be "members"
    without being subscribers to the list). The DB Primary Key field is also
    required in case of duplicate entries.
    - This appends one of two files, either a flat list of new members to
    subscribe or one to unsubscribe
    - An FTP access is created for the Linux Server, which will log the user
    directly into the folder where the text files are kept

    Then, on the Linux server:-

    - A cron job runs every night doing this sort of thing
    45 1 * * * /usr/local/bin/ncftpget -DD \
    ftp://user:pass at server.domain.com/unsub.txt
    46 1 * * * /usr/local/bin/ncftpget -DD \
    ftp://user:pass at server.domain.com/subsc.txt

    You need to install ncftpget. The -DD deletes the file if successfully
    retrieved.

    Then cron runs a script to do updating, looks like this:-

    50 1 * * * /path/to/subunsub

    That file is attached, along with the ASP file for what it's worth. If
    anyone converts it to PHP (I don't have the time) I'd appreciate
    receiving a copy. I have anonymised the scripts a bit, if there's
    anything private in there then I'm counting on your discretion, list
    readers. The output of the ASP script (to the browser) is in French. If
    you think you need a translation, then you probably don't understand the
    script well enough...

    subunsub is a simple bash script. It sends email to anyone you care to
    specify, in order to let them know who was subscribed and who was
    unsubscribed.

    Problems:

    - this only happens once a day, because it's not important for us to get
    people subscribed straight away. however, you could have cron look at
    the files more often without causing problems.

    - if someone subscribes via email (we disallow this because of that) then
    they won't be in the SQL DB. However, it also means they can only use
    the web form to unsubscribe. (oh, and the web form is NOT the Mailman
    web form, but a simple HTML page with two text boxes: one to subscribe
    with NAME="subsc" and one to unsubscribe with NAME="unsub")

    Neither of these files will work out-of-the-box on your systems. You
    have been warned.

    Hope this helps,

    --
    -Simon White, Internet Services Manager, Certified Check Point CCSA.
    -MTDS Internet, Security, Anti-Virus, Linux and Hosting Solutions.
    -MTDS 14, rue du 16 novembre, Agdal, Rabat, Morocco.
    -MTDS tel +212.3.767.4861 - fax +212.3.767.4863
    -------------- next part --------------
    <%

    '
    ' By Simon White. Credit where credit's due.
    '

    ' test
    Dim unsub, subsc, verif, connString, conn, rs, sSQL, count

    whichFN=server.mappath("/mailing/unsub.txt")
    whichFN2=server.mappath("/mailing/subsc.txt")
    unsub = request.querystring("unsub")
    subsc = request.querystring("subsc")
    count = 0

    if unsub <> "" then count=count+1
    if subsc <> "" then count=count+1

    if count > 1 then
    response.write "<P>Erreur: deux cases remplies, je ne peux pas d?cider quoi faire..."
    response.end
    end if

    ' DSN-less connection model, YMMV
    '
    'connString = "Provider=SqlOLEDB;Network LibraryÛMSSOCN;" & _
    ' "Data SourceÚTABASE_SERVER;" &_
    ' "Initial CatalogÚbatbase;" & _
    ' "User Id=user;" &_
    ' "Password=letmein;"
    '

    set conn = Server.CreateObject("ADODB.Connection")
    set rs = Server.CreateObject("ADODB.Recordset")

    'conn.open connString
    conn.open "DSN","user","pass"
    set rs.ActiveConnection = conn

    if unsub <> "" then
    sSQL = "SELECT IdentifiantPdc, email FROM coordonnees WHERE email='" & unsub & "';"
    rs.Open sSQL

    if rs.EOF then
    response.write "Adresse email non trouv?e"
    rs.close
    unsub=""
    else
    do while not rs.EOF
    IDtogo = rs.fields("IdentifiantPdc")
    response.write "Nom: " & rs.fields("nom")
    response.write "<BR>Prenom: " & rs.fields("prenom")
    response.write "<BR>Email: " & rs.fields("email")
    sSQL = "UPDATE coordonnees SET recevoirLettreInfo=0 WHERE IdentifiantPdc='" & IDtogo & "';"
    conn.execute sSQL
    response.write "<P>Cette personne est maintenant d?sabonn?e."
    rs.MoveNext
    loop
    rs.close

    ' Add the email to the list for batching later
    Set fstemp = server.CreateObject("Scripting.FileSystemObject")
    if not fstemp.FileExists(whichFN) then
    ' create the file
    Set filetemp = fstemp.CreateTextFile(whichFN, false)
    filetemp.WriteLine(unsub)
    filetemp.Close
    else
    ' open it and add some lines
    forappending = 8
    set filetemp=fstemp.OpentextFile(whichFN, forappending)
    filetemp.writeline(unsub)
    filetemp.close
    end if

    set filetemp=nothing
    set fstemp=nothing

    If err.number=0 then
    response.write "<P>Un fichier de synchronisation a ?t? correctement gen?r?."
    else
    response.write "VBScript Errors Occured!<br>"
    response.write "Error Number=#<b>" & err.number & "</b><br>"
    response.write "Error Desc. =<b>" & err.description & "</b><br>"
    response.write "Help Path =<b>" & err.helppath & "</b><br>"
    response.write "Native Error=<b>" & err.nativeerror & "</b><br>"
    response.write "Error Source =<b>" & err.source & "</b><br>"
    response.write "SQL State=#<b>" & err.sqlstate & "</b><br>"
    end if

    end if
    end if

    if subsc <> "" then
    sSQL = "SELECT IdentifiantPdc, email FROM coordonnees WHERE email='" & subsc & "';"
    rs.Open sSQL

    if rs.EOF then
    response.write "Adresse email non trouv?e"
    subsc=""
    rs.close
    else
    do while not rs.EOF
    response.write "<BR>Email: " & rs.fields("email")
    sSQL = "UPDATE coordonnees SET recevoirLettreInfo=1 WHERE IdentifiantPdc='" & rs.fields("IdentifiantPdc") & "';"
    conn.execute sSQL
    response.write "<P>Cette personne est maintenant abonn?e ? la liste<BR>"
    rs.MoveNext
    loop
    rs.close

    ' Add the email to the list for batching later
    Set fstemp = server.CreateObject("Scripting.FileSystemObject")
    if not fstemp.FileExists(whichFN2) then
    ' create the file
    Set filetemp = fstemp.CreateTextFile(whichFN2, false)
    filetemp.WriteLine(subsc)
    filetemp.Close
    else
    ' open it and add some lines
    forappending = 8
    set filetemp=fstemp.OpentextFile(whichFN2, forappending)
    filetemp.writeline(subsc)
    filetemp.close
    end if

    set filetemp=nothing
    set fstemp=nothing

    If err.number=0 then
    response.write "<P>Un fichier de synchronisation a ?t? correctement gen?r?."
    else
    response.write "VBScript Errors Occured!<br>"
    response.write "Error Number=#<b>" & err.number & "</b><br>"
    response.write "Error Desc. =<b>" & err.description & "</b><br>"
    response.write "Help Path =<b>" & err.helppath & "</b><br>"
    response.write "Native Error=<b>" & err.nativeerror & "</b><br>"
    response.write "Error Source =<b>" & err.source & "</b><br>"
    response.write "SQL State=#<b>" & err.sqlstate & "</b><br>"
    end if

    end if
    end if

    conn.close
    set rs=nothing
    set conn=nothing
    %>
    -------------- next part --------------
    #!/bin/bash
    ##
    ## Simple Bash Script by Simon White.
    ## Credit where credit's due
    ##

    if [ -f /root/unsub.txt ]
    then
    # file exists, so we can remove_members
    #
    /home/mailman/bin/remove_members -f /root/unsub.txt -N List-Name

    liste=`cat /root/unsub.txt`
    echo "To: Person at tonotify.com" > /root/unsubmessage
    echo "Subject: The unsubscribers have been treated" >> /root/unsubmessage
    echo "Unsubscribed: " >> /root/unsubmessage
    echo $liste >> /root/unsubmessage
    echo "." >> /root/unsubmessage

    cat /root/unsubmessage | /usr/sbin/sendmail -F "Mailman Mailing Server" -t
    sleep 10
    rm -f /root/unsub.txt
    fi


    if [ -f /root/subsc.txt ]
    then
    # file exists, so we can subscribe members
    #
    /home/mailman/bin/add_members -w n -r /root/subsc.txt List-Name

    liste=`cat /root/subsc.txt`
    noliste=`cat /root/subsc.txt | wc -l`
    echo "To: Person at tonotify.com" > /root/submessage
    echo "Subject: The subscribers have been sorted" >> /root/submessage
    echo "Subscribed: " >> /root/submessage
    echo "New subscribers today: $noliste" >> /root/submessage
    echo $liste >> /root/submessage
    echo "." >> /root/submessage

    cat /root/submessage | /usr/sbin/sendmail -F "Mailman Mailing Server" -t
    sleep 10
    rm -f /root/subsc.txt
    fi

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupmailman-users @
categoriespython
postedFeb 3, '03 at 1:47a
activeFeb 5, '03 at 3:29p
posts8
users4
websitelist.org

People

Translate

site design / logo © 2022 Grokbase