[Mailman-Users] Using cronjob to remove and add members to a mailing list
mark at msapiro.net
Sat Jun 6 18:20:18 CEST 2015
On 06/05/2015 09:04 AM, Jerry Barnabee wrote:
> I want to be able to run a cronjob on my server that uses a php script to add new users and/or remove users from a mailing list. Not having any luck finding any simple examples. My thought is that the php script would get email addresses from a database (which I can do) and then feed them to a mailman command line to either add or remove a user.
Mailman's sync_members command does exactly what you want. You would use
proc_open() in your php script to create pipes to and from the command,
then write the desired membership list one user per line in the form
"User's Name" <user at example.com>
to the command's input and read the output. The display name in the
above example is optional, but is used as the real_name attribute of a
user added by the command.
> The cronjob is entered via Cpanel. Have several cronjobs that modify databases but have never tried something that would actually execute a unix command.
In cPanel, the command you want is
will give usage info. The actual command you'd run with proc_open() is
/usr/local/cpanel/3rdparty/mailman/bin/sync_members -f - LISTNAME
where -f - says use stdin as the input and LISTNAME is the actual cPanel
list_domain list name. See the help for other options controlling
notices and whether or not to actually update the list or just report
(good for testing).
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users