Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jakobkmar/SimpleKotlinMail
A simple, coroutine based Kotlin Email API for both client- and server-side projects
https://github.com/jakobkmar/SimpleKotlinMail
coroutines email kotlin-jvm mail send-email smtp smtp-server
Last synced: about 1 month ago
JSON representation
A simple, coroutine based Kotlin Email API for both client- and server-side projects
- Host: GitHub
- URL: https://github.com/jakobkmar/SimpleKotlinMail
- Owner: jakobkmar
- License: apache-2.0
- Archived: true
- Created: 2021-01-08T17:19:34.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-25T16:16:40.000Z (over 2 years ago)
- Last Synced: 2024-05-21T13:44:32.323Z (8 months ago)
- Topics: coroutines, email, kotlin-jvm, mail, send-email, smtp, smtp-server
- Language: Kotlin
- Homepage: https://jakobkmar.github.io/SimpleKotlinMail/
- Size: 3.17 MB
- Stars: 64
- Watchers: 5
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - bluefireoly/SimpleKotlinMail (⭐66) - A simple, modern and coroutine based Kotlin Email API, supporting both clientside and serverside projects. (Recently Updated / [Aug 27, 2024](/content/2024/08/27/README.md))
README
_SimpleKotlinMail is a Kotlin Mail API, using coroutines and providing DSLs._
This project is **not actively being worked on anymore**, for an explanation and alternatives see https://github.com/jakobkmar/SimpleKotlinMail/issues/6#issuecomment-1082247403 .
## Features
- build emails
- send emails (using an external SMTP server)
- receive and process emails
- TLS support## To get started, visit the **[Documentation](https://jakobkmar.github.io/SimpleKotlinMail/)**.
## 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:
```kotlin
val email = emailBuilder {
from("[email protected]")
to("[email protected]")withSubject("Important question")
withPlainText("Hey, how are you doing?")
}
```### Send
Send that email:
```kotlin
suspend fun main() = email.send()
```### Server / Receive
Create a custom SMTPServer:
```kotlin
val smtpServer = smtpServer {
mailListener {
println(it.email.plainText)
}
}.start(keepAlive = true)
```### Convert
```kotlin
// EML String -> Email
string.toEmail()
// MimeMessage -> Email
mimeMessage.email
```### HTML
Inside the email builder, you can easily access kotlinx.html:
```kotlin
emailBuilder {
withHTML {
div {
h1 { +"Really important question!" }
p { +"Hey, how are you doing?" }
}
}
}
```### And more
To learn more about SimpleKotlinMail, visit the **[Documentation](https://jakobkmar.github.io/SimpleKotlinMail/)**.
## Project information
This project uses [SimpleJavaMail](https://www.simplejavamail.org/) to deal with java MimeMessages in a more elegant
way. On the server side, this projects depends on a fork of [SubEthaSMTP](https://github.com/davidmoten/subethasmtp).If you use the documented functionality of SimpleKotlinMail, everything will make use
of [kotlinx.coroutines](https://kotlinlang.org/docs/reference/coroutines-overview.html).