MailInbox class final

A local SMTP server for a world: a service in the stack that sends its own mail is pointed at it, and every mail that service sends is decoded and handed to onMail, the way a Dart server reports a mail it sends.

It accepts every mail from anyone to anyone. Any AUTH succeeds, so a service configured with a username and password needs no change beyond the host and port. It speaks plain SMTP only and never offers STARTTLS, so a service set to require TLS will not send through it.

With a relay, each mail also goes on, unchanged, to another SMTP server, usually the stack's own mail catcher, so the stack keeps showing what it showed before the world stepped in between.

Properties

hashCode → int
The hash code for this object.
no setterinherited
port → int
The port it listens on.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

close() → Future<void>
Stops accepting connections and drops the ones still open, then waits a few seconds at most for the mails already received to reach the relay. Whatever the relay has not taken by then is abandoned without an error.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

start({required void onMail(InboxMail mail), int port = 0, InternetAddress? address, ({String host, int port})? relay, void onRelayError(Object error)?}) → Future<MailInbox>
Listens on port (0 picks a free one) on the loopback address unless address says otherwise, and calls onMail with each mail received.