PostmarkEmailService

class PostmarkEmailService<C : KlerkContext, V>(apiKey: String, webhooksAuth: PostmarkEmailWebhooksAuth, serverID: Int? = null, val defaultFromAddress: BasicEmail.EmailAndName, messageStream: String = "outbound") : AdminUIPluginIntegration<C, V> , EmailSender<C, V>

Plugin for sending transactional email via Postmark.

Adds a block-function 'sendEmail' so that it is easy to trigger emails via your state machines:

onEvent(ApproveInvoice) {
sendEmail(::generateNotificationEmail)
transitionTo(Approved)
}

It is also possible to send via a normal Klerk command:

klerk.handle(
Command(
event = PostmarkEmailService.CreateEmail,
model = null,
params = CreateEmailParams.from(PostmarkEmail(
...

When an email should be sent, a PluginPostmarkEmail model is and a Job is created to process the email in a fault-tolerant way. The model will be deleted some time after the email has been processed.

Parameters

serverID

is not required, but there will be no link in AdminUI to the email details page on postmarkapp.com unless it is provided.

Constructors

Link copied to clipboard
constructor(apiKey: String, webhooksAuth: PostmarkEmailWebhooksAuth, serverID: Int? = null, defaultFromAddress: BasicEmail.EmailAndName, messageStream: String = "outbound")

Properties

Link copied to clipboard
Link copied to clipboard
open override val description: String
Link copied to clipboard
open override val name: String
Link copied to clipboard
open override val page: PluginPage<C, V>

Functions

Link copied to clipboard
open override fun getSendEmailCommand(email: BasicEmail): Command<out Any, out Any>
Link copied to clipboard
open override fun mergeConfig(previous: Config<C, V>): Config<C, V>
Link copied to clipboard
open override fun registerExtraRoutes(routing: Routing, basePath: String)
Link copied to clipboard
open suspend override fun sendEmail(email: BasicEmail, context: C): Result<JobId>
Link copied to clipboard
open override fun start(klerk: Klerk<C, V>)