1.1.2 • Published 7 months ago

micromta v1.1.2

Weekly downloads
1
License
BSD-3-Clause-Clea...
Repository
github
Last release
7 months ago

NOTICE: This project will no longer be maintained, please use @typemail/smtp instead.

microMTA is a Mail Transfer Agent (MTA) library for node.js that focuses on receiving messages. The only feature of microMTA is message receiving. No sending or relaying will be possible since the library itself is not designed to handle that.

microMTA was created for testing e-mail sending in an application, by mocking a SMTP server. By default it runs on port 25 (which requires superuser privileges or an authbind/setcap setup).

The library is available in npm, use yarn add micromta or npm install micromta to install.

ParserBuilder
letterparserletterbuilder

Example

const mta = new microMTA();
mta.on('message', message => console.log(message));

// Later:
mta.close();

message will be of the type microMTAMessage:

export interface microMTAMessage {
  recipients: string[];
  sender: string;
  message: string;
}

The message is a raw message that needs to be parsed. letterparser can be used to parse and extract data from the raw messages.

Options

The constructor for microMTA accepts an options object.

PropertyDefault valueDescription
ip0.0.0.0IP address to bind to.
port25Port to bind to. (Ports under 1024 usually require superuser privileges.)
hostnamelocalhostHostname advertised by the SMTP server.
size1000000Maximum message size (in bytes).
tlsundefinedcreateSecureContext options for STARTTLS support.
tlsPost465Port for secure only communication, only enabled if tls is configured properly.
authenticateundefinedAuthentication function. See Authentication for more details.

Events

message

Emitted when a message is succesfully received.

error

Emitted when an error occurs.

rejected

Emitted when a message is rejected. For now, this only happens when the message exceeds the maximum size.

Authentication

microMTA supports PLAIN and LOGIN methods for SMTP authentication. To enable authentication, a function of following type must be passed with the options object:

  authenticate?: (
    connection: microMTAConnection,
    username: string,
    password: string,
    authorizationIdentity?: string
  ) => boolean | Promise<boolean>;
1.1.2

7 months ago

1.1.1

3 years ago

1.1.0

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.0.1

4 years ago