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());
}
?>
Getting started (Previous) Services_ReCaptcha (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.