Kotlinmailer 2.0 is a Kotlin Multiplatform library with its own SMTP and JMAP clients. It no longer depends on SimpleJavaMail or Jakarta Mail, so the SimpleJavaMail types are gone from the API.
email.send() now suspends until the email was accepted and returns a SendReceipt instead of a Job. Replace email.send().join() with email.send(). sendSync() was removed; use runBlocking { email.send() } on the JVM if you really need to block.
Email builder
1.x
2.0
withSubject("...")
subject = "..."
withPlainText("...")
text = "..."
withHTMLText("...")
html = "..."
appendText, prependText
unchanged
withAttachment(name, bytes, type)
attach(name, bytes, type)
withEmbeddedImage(name, bytes, type)
embed(contentId, bytes, type)
withHeader(name, value)
header(name, value)
from(InternetAddress(...))
from("Name <address>")
email.reply(from = "x") {}
email.reply(from = EmailAddress("x")) {}
email.forward(from = "x") {}
email.forward(from = EmailAddress("x")) {}
Conversion
email.eml still works. Parsing (String.toEmail(), MimeMessage.email) and email.mimeMessage were removed.
Removed features
The advanced SimpleJavaMail features (S/MIME, DKIM signing, batch module, proxies, calendar invites, ...) are not part of 2.0. If you need one of them, please open a feature request and describe your use case, or add a 👍 to an existing one. Until it is available, stay on 1.x.