smtp 1.0.0+1 smtp: ^1.0.0+1 copied to clipboard
An SMTP 5321 server implementation in Dart. Use this to receive e-mail messages within the Dart VM.
smtp #
An SMTP 5321 server implementation in Dart.
Usage #
This SMTP server should not be used as your front-facing server, especially in production. Consider setting up Postfix to relay e-mail to this server; that way, you can be sure that only well-formed e-mail messages will touch your Dart code.
Note that this includes no spam protection, etc., and is simply a plain SMTP server library.
main() async {
var server = await SmtpServer.bind('127.0.0.1', 0);
await for (var mailObject in server.mailObjects) {
print(mailObject.envelope.originatorAddress);
print(mailObject.envelope.headers.cc);
mailObject.close(statusCode: 221, reasonPhrase: 'Bye!');
}
}