Aller directement à la fin des métadonnées
Aller au début des métadonnées

Mailman synchronization

This page describes how to manage Mailman (http://www.gnu.org/software/mailman/) lists with CiviCRM Smart Groups.

Subscribing and unsubscribing functions are done through CiviCRM instead of Mailman. Mail delivery and archiving functions remain with Mailman. You should customize various Mailman pages and messages with instructions on how subscribers can unsubscribe or change their email address, instead of Mailman pages. If possible you should disable certain Mailman email command addresses so that people can't change their Mailman subscription via email commands.

If your subscribers have access to their CiviCRM record they may use that to unsubscribe or change their preferences, or you may write a custom interface using the CiviCRM API. While not covered here, under this scenario people could type in their email address and be sent a unique link to click to change their settings.

Prerequisites: The script below assumes you are running CiviCRM and Mailman on the same server but it could be adapted if they are on different servers. You will need sufficient access to run a PHP script and Mailman's sync_members utility on the server. The script extracts list members using the CiviCRM API then calls sync_members.

The script will populate Mailman's real name field in addition to the email address.  

1. Set up a CiviCRM Group for each Mailman list. For help in creating groups see http://en.flossmanuals.net/civicrm/ch017_tags-and-groups/. The new group will appear in the Manage Groups page. You will need the ID listed against the group, for use in the script below.

2. Copy the script below and save it under the name sync2mailman.php

3. Customize the script according to your setup, including file paths. You will need to customize script and file paths. Add a SyncList(...) call at the bottom of the file for each list.

4. Test the script to make sure it performs how you expect.

5. Remove the -n from $mmcommand to ensure that the changes are actually made

6. Setup a cron. For example "php -f /home/myusername/bin/sync2mailman.php"

7. Enjoy !

Example with mailman on another server

If you are running CiviCRM on one server, and mailman on another server, you can do something like this.  This requires shell access to both servers.

  1. Create an ssh keypair on the CiviCRM server and use it to set up password-less SSH access to your mailman server.  You probably want to create a user on the mailman server with the minimal permissions necessary to run sync_members
  2. Create a directory named sync-files under the home directory of your user on the mailman server
  3. Create a directory on your CiviCRM server, named whatever you want (also sync-mailman in this example) and create two files:
  4. sync-mail.sh with permissions set to 755

  5. sync-mail.php

  6. Now when you run sync-gs.sh it will run the php file to create one file with email contacts for each group.  Next it will copy those files to the mailman server.  Then it logs into the mailman server and merges the contacts for each list.
  7. Set up a cron and enjoy!

 

 

 

 

Étiquette
  • Aucun
  1. Mar 01, 2013

    shawn holt dit :

    I'm not a developer, but I noticed civicrm_contact_search is a depreciated API Legacy Contact APIs#civicrm_contact_search(&$params)-DEPRECATED - - just a heads-up ...

    1. Mar 14, 2013

      JoeMurray dit :

      Noted. Thanks!