com.lightningkite.lightningserver.email.MailgunTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of server-core Show documentation
Show all versions of server-core Show documentation
A set of tools to fill in/replace what Ktor is lacking in.
The newest version!
package com.lightningkite.lightningserver.email
import kotlinx.coroutines.runBlocking
import org.junit.Test
import java.io.File
class MailgunTest {
@Test
fun testMailgun() {
val credentials = File("local/test-mailgun.txt")
if (!credentials.exists()) {
println("No credentials to test with at ${credentials.absolutePath}")
return
}
val client = EmailSettings(credentials.readText())()
println((client as MailgunEmailClient).key)
println((client as MailgunEmailClient).domain)
runBlocking {
client.send(Email("Test", to = listOf(EmailLabeledValue("[email protected]")), plainText = "Test Message"))
}
}
}