npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

milterjs

v0.0.3

Published

javascript milter api client

Readme

milterjs

npm version Build Status Coverage Status NSP Status Dependencies Status

sendmail milter protocol javscript client library

help you write a sendmail/postfix milter in javascript

EXEMPLE

var milterjs = require('milterjs');

milterjs.on('helo', function(ctx) {
  console.log('helo event !');
  ctx.continue();
});

milterjs.listen(9568, '127.0.0.1');

METHODS

on(eventName, listener)

Call a function on a specified event.

  • eventName: The name of the event.
  • listener: The callback function called on event previously specified.

listen(port, [host])

Start listening for sendmail/postfix connections on the given port and host.

  • port: number of port
  • host: ipv4 or ipv6 string address, default is 0.0.0.0

EVENTS

| EventName | Parameters | accept/reject Action | Description | | --------- | ---------- | -------------------- | ----------- | | abort | ctx | no | cancel current message and get ready to process a new one. | | body | ctx, BodyChunk | yes | Body chunk (up to MILTER_CHUNK_SIZE (65535) bytes.) | connect | ctx, hostname, connection_type, address, port | yes | SMTP connection information. | | eom | ctx | yes | the end of the body. | | helo | ctx, heloName | yes | HELO/EHLO name | | envfrom | ctx, sender | yes | array[0] sender, with <> qualification. array[1] and beyond are ESMTP arguments, if any. | | header | ctx, header | no | array[0] header, array[1] value | | eoh | ctx | yes | the end of headers. | | envrcpt | ctx, recipient | yes | array[0] recipient, with <> qualification. array[1] and beyond are ESMTP arguments, if any. | | data | ctx | yes | end of data. | | close | ctx | no | close milter connection. | | unknown | ctx, command | no | tell the milter that an unknown smtp command has been received. | | error | error | no | an error has occur. |

CTX

ctx is the Milter context object.

ATTRIBUTES

  • version: the milter protocol version of MTA.
  • macros: object containing all macros.
  • uniqueID: unique identifier for milter connection.

METHODS

accept(): Accept message completely (accept/reject action)

This will skip to the end of the milter sequence, and recycle back to the state before SMFIC_MAIL. The MTA may, instead, close the connection at that point.

continue(): Accept and keep processing (accept/reject action)

If issued at the end of the milter conversation, functions the same as accept().

discard(): Set discard flag for entire message (accept/reject action)

Note that message processing MAY continue afterwards, but the mail will not be delivered even if accepted with accept().

reject(): Reject command/recipient with a 5xx (accept/reject action)

tempfail(): Reject command/recipient with a 4xx (accept/reject action)

replycode(code, message): Send specific Nxx reply message (accept/reject action)

  • code: string with length of 3 characters. see
  • message: string

progress(): Progress (asynchronous action)

This is an asynchronous response which is sent to the MTA to reset the communications timer during long operations. The MTA should consume as many of these responses as are sent, waiting for the real response for the issued command.

quarantine(reason): Quarantine message (modification action)

  • reason: string This quarantines the message into a holding pool defined by the MTA.

addheader(header, value): Add header (modification action)

  • header: string
  • value: string

addrcpt(rcpt): Add recipient (modification action)

  • rcpt: string email of new recipient

chgheader(header, num, value): Change a header (modification action)

  • header: string
  • num: number (integer value)
  • value: string Change the num'th header of name header to the value value

delrcpt(rcpt): Remove address rcpt from the list of recipients for this mail (modification action)

  • rcpt: string

replacebody(chunk): Replace the message body (modification action)

  • chunk: string Replace the message body with the chunk. This method may be called multiple times, each call appending to the replacement buffer. End-of-line should be represented by CR-LF ("\r\n").

setsender(sender): Replace the envelope sender address (modification action)

This method provides an implementation to access the mlfi_setsender method added to the libmilter library as part of the mlfi-setsender project