A simple, modern and coroutine based Kotlin Email API for clientside projects

Last update: Jun 19, 2022

Kotlinmailer Logo Kotlinmailer Logo

Kotlinmailer is a Kotlin Mail API, using coroutines and providing DSLs. It may be used in a Ktor Backend for verification mails.

This project is a hard fork from SimpleKotlinMail which is no more actively worked on.

Features

  • build emails
  • send emails (using an external SMTP server)
  • TLS support

To get started, visit the Documentation.

Setup

Using Kotlinmailer requires Kotlin compiler 1.4.0 or higher due to the dependency on Kotlin Serialization

Gradle

Kotlin DSL:

repositories {
    mavenCentral()
}

dependencies {
    implementation("at.quickme.kotlinmailer:kotlinmailer-core:0.2.0")
    // Optional for Kotlinx HTML DSL support
    implementation("at.quickme.kotlinmailer:kotlinmailer-html:0.2.0")
}

Groovy DSL:

repositories {
    mavenCentral()
}

dependencies {
    implementation "at.quickme.kotlinmailer:kotlinmailer-core:0.2.0"
    // Optional for Kotlinx HTML DSL support
    implementation "at.quickme.kotlinmailer:kotlinmailer-html:0.2.0"
}

JVM Version

To be able to use the inline functions of the API, you have to configure the JVM version (if you have not done that already).

tasks.withType<KotlinCompile> {
    kotlinOptions.jvmTarget = jvmVersionString // <- e.g. 11
}

Examples

The purpose of the following code snippets is to provide an insight into the API. However, they are not suitable for learning the API, you should use the actual documentation for this.

Build

Build an email:

val email = emailBuilder {
    from("[email protected]")
    to("[email protected]")

    withSubject("Important question")
    withPlainText("Hey, how are you doing?")
}

Send

Send that email:

suspend fun main() = email.send()

Convert

// EML String -> Email
string.toEmail()
// MimeMessage -> Email
mimeMessage.email

HTML

Inside the email builder, you can easily access kotlinx.html:

emailBuilder {
    withHTML {
        div {
            h1 { +"Really important question!" }
            p { +"Hey, how are you doing?" }
        }
    }
}

And more

To learn more about Kotlinmailer, visit the Documentation.

Project information

This project uses SimpleJavaMail to deal with java MimeMessages in a more elegant way.

If you use the documented functionality of SimpleKotlinMail, everything will make use of kotlinx.coroutines.

GitHub

https://github.com/BierDav/Kotlinmailer
You might also like...

🎥 A Simple and Minimal Movies Android Application to demonstrate the Modern Android Development and Jetpack Compose.

🎥 A Simple and Minimal Movies Android Application to demonstrate the Modern Android Development and Jetpack Compose.

ComposeMovie Android 🎥 A Simple and Minimal Movies Android Application to demonstrate the Modern Android Development and Jetpack Compose. Built with

Apr 8, 2022

Healthify - An app to track your daily water intake and sleep and boost your work efficiency. Healthify is built using Kotlin and follows all modern android Development practices and hence is a good learning resource for beginners

Healthify - An app to track your daily water intake and sleep and boost your work efficiency. Healthify is built using Kotlin and follows all modern android Development practices and hence is a good learning resource for beginners

Healthify Healthify is an app to track your daily water intake and sleep and boost your work efficiency. Video Introduction 📹 This is a small introdu

Jun 21, 2022

An Open Source App which enables users to drop all their professional handles and projects at one place.

An Open Source App which enables users to drop all their professional handles and projects at one place.

An Open Source App which enables users to drop all their professional handles and projects at one place. This is a Beginner Friendly Repository made for Open Source Enthusiasts who can contribute to the App during HacktoberFest 2021.

May 26, 2022

Help users of coding platforms to create findable, well documented, secure and offering good quality projects

The Ambassador The Ambassador will help users of coding platforms to create findable, well documented and offering good quality projects. It measures

May 23, 2022

This app is used to divide a particular task in subtask and assign it to others with priorities. This may be useful for team projects or collaborative work

This app is used to divide a particular task in subtask and assign it to others with priorities. This may be useful for team projects or collaborative work

TaskDivider-Android-App This app is used to divide a particular task in subtask and assign it to others with priorities. This may be useful for team p

Jan 10, 2022

💰 Expense Manager is simple, intuitive, stable and modern app that is just designed for you.

💰 Expense Manager is simple, intuitive, stable and modern app that is just designed for you.

Expense Manager is simple, intuitive, stable and modern app that is just designed for you. Everything you need at your fingertips to manage the expenditures and budgets.

May 22, 2022

A Simple and Minimal Quotes Android Application to demonstrate the Modern Android Development tools

A Simple and Minimal Quotes Android Application to demonstrate the Modern Android Development tools

Quotee Android 📑 A Simple and Minimal Quotes Android Application to demonstrate the Modern Android Development tools. Developed with ❤️ by Aminullah

Apr 8, 2022

A simple Android project using modern Android development tools and libraries.

A simple Android project using modern Android development tools and libraries.

A simple Android project using modern Android development tools and libraries.

Feb 3, 2022

Taskify - An app to manage your daily tasks and boost your productivity. Taskify is built using kotlin and follows all modern android Development practices and hence is a good learning resource for beginners

Taskify - An app to manage your daily tasks and boost your productivity. Taskify is built using kotlin and follows all modern android Development practices and hence is a good learning resource for beginners

Taskify Taskify is an app to manage your daily tasks and boost your productivity Video Introduction 📹 This is a small introduction video about Taskif

Jun 21, 2022
Related tags
FairEmail is easy to set up and works with virtually all email providers, including Gmail, Outlook and Yahoo!
FairEmail is easy to set up and works with virtually all email providers, including Gmail, Outlook and Yahoo!

Downloads • Privacy • Support • License FairEmail Fully featured, open source, privacy oriented email app for Android FairEmail is easy to set up and

Jun 23, 2022
An simple image gallery app utilizing Unsplash API to showcase modern Android development architecture (MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit)
An simple image gallery app utilizing Unsplash API to showcase modern Android development architecture (MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit)

Imagine App An simple image gallery app utilizing Unsplash API. Built with ❤︎ by Wajahat Karim and contributors Features Popular photos with paginatio

Jun 15, 2022
Movie Android App written in Kotlin, MVVM, RxJava, Coroutine (Upcoming), Android Architecture Components and Jetpack Compose (Upcoming).
Movie Android App written in Kotlin, MVVM, RxJava, Coroutine (Upcoming), Android Architecture Components and Jetpack Compose (Upcoming).

MovieHunt MovieHunt is a sample Android project using The Movie DB API based on MVVM architecture. It showcases the latest Android tech stacks with we

Jun 15, 2022
Simple Notes app demonstrates modern Android development with Hilt, Material Motion, Coroutines, Flow, Jetpack (Room, ViewModel) based on MVVM architecture.
Simple Notes app demonstrates modern Android development with Hilt, Material Motion, Coroutines, Flow, Jetpack (Room, ViewModel) based on MVVM architecture.

Simple Notes app demonstrates modern Android development with Hilt, Material Motion, Coroutines, Flow, Jetpack (Room, ViewModel) based on MVVM architecture.

Apr 8, 2022
simple-flank is a Gradle plugin to use Flank in Android projects with no configuration needed

simple-flank simple-flank is a new gradle plugin with a clear focus: make the setup as simple as possible. Applied to any application or library modul

May 10, 2022
Android Clean Architecture Kick Start project with MVVM, Coroutine, DI, Caching, Networking.

Android Clean Architecture Kick Start project with MVVM, Coroutine, DI, Caching, Networking Stacks: Clean Architecture MVVVM Local Caching (StoreX) Ne

Jun 18, 2022
(Coroutine, Flow(+StateFlow), Hilt, JetPack, MVVM, Repository Pattern, Retrofit2 & OkHttp3, Moshi, Glide, Timber, Material-Components)

(Coroutine, Flow(+StateFlow), Hilt, JetPack, MVVM, Repository Pattern, Retrofit2 & OkHttp3, Moshi, Glide, Timber, Material-Components)

Apr 13, 2022
An Open-Source repository that contains all the Android Dev and Kotlin concepts and several projects on android ranging in difficulty making this repo completely beginner-friendly.
An Open-Source repository that contains all the Android Dev and Kotlin concepts and several projects on android ranging in difficulty making this repo completely beginner-friendly.

An Open-Source repository that contains all the Android Dev and Kotlin concepts and several projects on android ranging in difficulty making this repo completely beginner-friendly. The main aim of this repository is to help students who are learning Android Development or preparing for an Android Developer role-based job.

Jun 17, 2022
NewsApp is a an android project based on modern Android application tech-stacks and MVVM architecture.

NewsApp NewsApp is a an android project based on modern Android application tech-stacks and MVVM architecture. This project is for focusing especially

Jan 14, 2022
☀️ Wheater is a small demo application based on modern Android tech-stacks and MVVM architecture. ⛅
☀️ Wheater is a small demo application based on modern Android tech-stacks and MVVM architecture. ⛅

Wheater is a small demo application based on modern Android tech-stacks and MVVM architecture. Tech stack & Open-source libraries Minimum SDK level 19

Jan 17, 2022