All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lightningkite.lightningserver.email.SmtpTest.kt Maven / Gradle / Ivy

The newest version!
package com.lightningkite.lightningserver.email

import com.lightningkite.lightningserver.serialization.Serialization
import kotlinx.coroutines.runBlocking
import kotlinx.serialization.decodeFromString
import org.junit.Test
import java.io.File

class SmtpTest {
    @Test
    fun testSmtp() {
        val credentials = File("local/test-smtp.json")
        if (!credentials.exists()) {
            println("No credentials to test with at ${credentials.absolutePath}")
            return
        }
        val client = SmtpEmailClient(credentials.readText().let { Serialization.json.decodeFromString(credentials.readText()) })
        runBlocking {
            client.send(Email(
                subject = "Subject 2", fromLabel = "Joseph Ivie", fromEmail = "[email protected]",
                to = listOf(EmailLabeledValue("[email protected]", "Joseph Ivie")),
                html = "

Hello world!

", )) } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy