Skip to content
SpamAssassin message evaluator for node.js
JavaScript
Latest commit 57ef98f May 8, 2012 Humantech updated usage
Failed to load latest commit information.
examples 0.0.2 version, minor fixes; error handling and package.json fix for npm Mar 13, 2012
lib implement rules list on return May 8, 2012
test
.gitignore implement rules list on return May 8, 2012
LICENSE
README.md updated usage May 8, 2012
package.json version bump May 8, 2012

README.md

Spamd (SpamAssassin) client for node.js

This library use sockets to send a message to SpamAssassin daemon for evaluation.

Based on the SpamAssassin plugin from Haraka.

Install from npm

npm install node-spamd

Usage

var Spamd = require("node-spamd");
var spamd  = new Spamd(sender, receiver, host, port);

spamd.evaluate(subject, message, function(res, err){

    if(err) {
        console.log(err);
    } else {
        if(res.spam) {
            console.log('The message is Spam, is evaluated with ' + res.evaluation + " points in a maximun of " + res.allowed);
        }else{
            console.log('The message is not Spam, is evaluated with ' + res.evaluation + " points in a maximun of " + res.allowed);
        }
    }
});

sender: Sender e-mail address/user. Default value: root
receiver: Receiver e-mail address/user. Default value: root
host: Spamd address. Default value: localhost
port: Spamd port. Default value: 783
subject: String containing the message subject.
message: String containing the message body.

Return value

The method returns an object, with the following attributes:

spam = true or false. Indicates the result of SpamAssassing analysis.
evaluation = Number or points or hits, that the message has obtained.
allowed = Configured minimal required points for SpamAssassin mark the message as SPAM. This is a spamd setting.
rules = Array with detected spam infractions

TODO

  • document source code;
  • real documentation;
  • jsHint standards we don't like code standards.

License

Copyright (C) 2012 Humantech

Distributed under the MIT License, the same as Node.js.

Read this if you're in doubt.

Something went wrong with that request. Please try again.