Skip to content

savekirk/mailroom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Kotlin Ktor License

Mailroom

Mailroom is a Kotlin email composition and delivery library for server-side applications.

Features

  • Framework-agnostic core for any Kotlin server app
  • Type-safe HTML DSL with kotlinx.html
  • Pluggable adapters for SMTP, SES, Resend, local, and testing
  • Optional Ktor plugin and mailbox preview UI

Quick Start

Add the dependencies:

dependencies {
    implementation("dev.dela:mailroom-core:X.Y.Z")
    implementation("dev.dela:mailroom-smtp:X.Y.Z")
}

Configure, compose, and send:

val mailer = DefaultMailer(
    SmtpAdapter(
        SmtpConfig(
            host = "smtp.example.com",
            port = 587,
            username = System.getenv("SMTP_USERNAME"),
            password = System.getenv("SMTP_PASSWORD"),
            useTLS = true,
        ),
    ),
)

val result = mailer.deliver(
    email {
        from("noreply@example.com", "My App")
        to("user@example.com", "User Name")
        subject("Welcome")
        textBody("Thanks for signing up!")
    },
)

when (result) {
    is DeliveryResult.Success -> println("Sent: ${result.messageId}")
    is DeliveryResult.Failure -> println("Failed: ${result.reason}")
}

Documentation:

Available Adapters

  • mailroom-smtp — SMTP adapter built on Jakarta Mail (Gmail, Mailgun SMTP, etc.).
  • mailroom-ses — Amazon SES adapter using the AWS SDK for Kotlin.
  • mailroom-resend — Resend HTTP adapter.
  • mailroom-local — In-memory adapter for local development with mailbox storage.
  • mailroom-test — Test adapter with assertion DSL for verifying sent emails.

Requirements

  • Kotlin 2.1 or later
  • JVM 17 or later
  • Gradle 7.6.3 or later (built with Gradle 9.0)
  • Coroutines support
  • Ktor 3.2+ (only if using mailroom-ktor and mailroom-preview)

License

MIT License - see LICENSE for details.

Inspiration

Mailroom is inspired by Swoosh, the excellent email library for Elixir.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages