pekko-smtp-server

Scala CI Coverage Status Codacy Badge codecov Maven Central Maven Central

Smtp server based on pekko stream.

Add to your project:

 libraryDependencies += "com.github.ajozwik" %% "pekko-smtp" % "0.4.0"

For minimal usage you need to provide consumer method with signature (Mail=>Future[ConsumedResult]). consumer method receives Mail object, and it repeats with Future[SuccessfulConsumed] or Future[FailedConsumed].

AddressHandler.scala is an optional implementation for fail fast address resolution (blacklist).

Usage: Implement trait Consumer

Example implementation: LogConsumer

Example usage:

  • Pack project

sbt pack

pekko-smtp/target/pack/bin/main -Dconsumer.class=pl.jozwik.smtp.server.consumer.FileLogConsumer

  • or use a project as a dependency and provide own Main class

List of tls system properties (optional):

  • consumer.class - class to consume messages
  • smtp.tls.client.keyStorePassword - password for client key store
  • smtp.tls.protocol - TLS protocol
  • smtp.tls.keyStorePassword - password for key store
  • smtp.tls.keyStoreFile - path to key store
  • smtp.tls.keyStoreResource - path to key store resource
  • smtp.tls.trustStorePassword - password for trust store
  • smtp.tls.trustStoreFile - path to trust store
  • smtp.tls.trustStoreResource - path to trust store resource
  • smtp.tls.ephemeral - generate a throwaway self-signed key/trust store instead of requiring one
  • smtp.size - max size of message in bytes
  • smtp.port - port to connect to

Thanks to https://github.com/alexbokos/sslengine.example for example of tls/ssl implementation.

For build docs/README.md use:

docs/mdoc --out .