
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
sendmail milter protocol javscript client library
help you write a sendmail/postfix milter in javascript
var milterjs = require('milterjs');
milterjs.on('helo', function(ctx) {
console.log('helo event !');
ctx.continue();
});
milter.listen(9568, '127.0.0.1');
Call a function on a specified event.
Start listening for sendmail/postfix connections on the given port and host.
0.0.0.0| 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. |
| eoh | ctx | yes | the end of headers. |
| envrcpt | ctx, recipients | 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 is the Milter context object.
version: the milter protocol version of MTA.macros: object containing all macros.uniqueID: unique identifier for milter connection.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. seemessage: stringprogress(): 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: stringvalue: stringaddrcpt(rcpt): Add recipient (modification action)rcpt: string email of new recipientchgheader(header, num, value): Change a header (modification action)header: stringnum: number (integer value)value: string
Change the num'th header of name header to the value valuedelrcpt(rcpt): Remove address rcpt from the list of recipients for this mail (modification action)rcpt: stringreplacebody(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
FAQs
javascript milter api client
The npm package milterjs receives a total of 3 weekly downloads. As such, milterjs popularity was classified as not popular.
We found that milterjs demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.