Examples
List all available mailing lists on the server
<?php
require_once 'Services/Mailman.php';
$mm = new Services_Mailman('http://example.org', '', 'adminpass');
try {
$mailinglists = $mm->lists();
foreach ($mailinglists as $list) {
echo $list['name'] . "\n";
}
} catch (Services_Mailman_Exception $e) {
die('Error: ' . $e->getMessage());
}
?>
Subscribing a user to a mailing list
<?php
require_once 'Services/Mailman.php';
$mm = new Services_Mailman('http://example.org', 'foo-users', 'adminpass');
try {
$mm->subscribe('user@example.org');
} catch (Services_Mailman_Exception $e) {
die('Error: ' . $e->getMessage());
}
?>
Unsubscribing a user from a mailing list
<?php
require_once 'Services/Mailman.php';
$mm = new Services_Mailman('http://example.org', 'foo-users', 'adminpass');
try {
$mm->unsubscribe('user@example.org');
} catch (Services_Mailman_Exception $e) {
die('Error: ' . $e->getMessage());
}
?>