Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ezmlm

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ezmlm

Ezmlm wrapper for Node.js

  • 0.1.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Ezmlm wrapper for Node.js

Build Status Dependency Status NPM version

Install

npm i --save ezmlm

Usage

ezmlm = require("ezmlm");

The API looks as follows:

ezmlm.COMMAND(COMMAND_OPTIONS [, CALLBACk]);

whereas COMMAND can be

  • make
  • list
  • sub
  • unsub

other ezmlm commands are not implemented yet. Feel free to fork this repo and hack a new feature!

The COMMAND_OPTIONS object holds the basic and optional parameters. The basic parameters for most commands are:

var cfg = {
  name:   "mylist",   // required
  dir:    "./mylist", // default
};

The CALLBACK function takes two parameters, the error object and the result:

var callback = function(err, result){
  if (err)
    return console.error("uuups...");
  // do s.th. with the result
}

If you omit the CALLBACK, you'll get the coresponding command string:

ezmlm.list({name: "foo", type: "mod"}); // returns 'ezmlm-list ./foo mod'

Examples

var listname = "mylist"
ezmlm.make({
    name:     listname,               // required
    domain:   "example.org",          // required
    dir:      "./"+ listname,         // default
    qmail:    "./.qmail-" + listname, // default
    config:   "/etc/ezmlm/de",        // optional
    owner:    "foo@bar.tld",          // optional
    from:     "baz@bar.tld",          // optional
    switches: "AbDfglMrstu"           // optional
    modify:   false                   // default
  },
  function(err){ /* ... */ }
);

ezmlm.list({
    name: "listname",
    type: "mod"
    // possible values: 'mod', 'allow'
    // if omitted the normal subscribers are read
  },
  function(err, res){
    if (err)
      return console.error("could not read subscribers: ", err.message);
    for (var i in res){
      console.log(res[i] + " is a moderator of the " + cfg.name + " list");
    }
  }
);

ezmlm.sub({
    name: "listname",
    type: 'allow',
    addresses: ["foo@example.org"]
  },
  function(err){ /* ... */ }
})

ezmlm.unsub({
    name: "listname",
    addresses: ["foo@example.org"]
  },
  function(err){ /* ... */ }
);

List class

var myList = new ezmlm.List("foo");

myList.on("sub", function(ev){
  console.log(ev.addresses); // array of all new addresses
  console.log(ev.type);      // array name (e.g. subscribers)
});

myList.on("unsub", function(ev){
  console.log(ev.addresses); // array of deleted addresses
  console.log(ev.type);      // array name (e.g. moderators)
});

myList.on("error", function(err){
  console.error(err);
});

myList.on("ready", function(){
  myList.subscribers  // array of addresses
  myList.moderators   // array of addresses
  myList.aliases      // array of addresses
  myList.watch(function(){
    // ready to watch changes
    myList.sub(["new@address.tld"], function(err){ /* ... */ });
    myList.sub(["foo@bar.tld"],'moderators', function(err){ /* ... */ });
    myList.unsub(["old@address.tld"]);
  });
});

Tests

npm test

License

node-ezmlm is licensed under the MIT license.

Keywords

FAQs

Package last updated on 15 Oct 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc