Functions

email alias of ::postmark::send/send-single-email

fn (request: SendEmailRequest): SendEmailResponse
fn (request: SendEmailRequest, opts: Map): SendEmailResponse

Send a single email via the Postmark API.

Example

response ::postmark::send/send-single-email(::postmark::send/SendEmailRequest({
    From: "sender@example.com",
    To: "recipient@example.com",
    Subject: "Welcome!",
    TextBody: "Plain text body.",
    HtmlBody: "<html><body><p>HTML body</p></body></html>"
}))
response.MessageID // => "unique-message-id"
response.ErrorCode // => 0

send-batch-email-using-templates

fn (request: SendEmailBatchWithTemplatesRequest): SendEmailBatchWithTemplatesResponse
fn (request: SendEmailBatchWithTemplatesRequest, opts: Map): SendEmailBatchWithTemplatesResponse

Send a batch of emails using templates in a single API call.

Example

results ::postmark::send/send-batch-email-using-templates({Messages: [
    {TemplateAlias: "welcome", TemplateModel: {name: "Ada"}, From: "sender@example.com", To: "ada@example.com"},
    {TemplateAlias: "welcome", TemplateModel: {name: "Alan"}, From: "sender@example.com", To: "alan@example.com"}
]})

// One result per message, in order
first(results).MessageID

send-batch-emails

fn (request: SendEmailBatchRequest): SendEmailBatchResponse
fn (request: SendEmailBatchRequest, opts: Map): SendEmailBatchResponse

Send a batch of emails in a single API call.

Example

results ::postmark::send/send-batch-emails(::postmark::send/SendEmailBatchRequest([
    {From: "sender@example.com", To: "ada@example.com", Subject: "Hello", TextBody: "Hi Ada."},
    {From: "sender@example.com", To: "alan@example.com", Subject: "Hello", TextBody: "Hi Alan."}
]))

// One result per message, in order
first(results).MessageID

// With a tenant's server token
::postmark::send/send-batch-emails([{From: "sender@example.com", To: "ada@example.com", Subject: "Hello", TextBody: "Hi Ada."}], {
    server-token: ::hot::ctx/get("tenant.postmark.token")
})

send-email-using-template

fn (request: SendEmailWithTemplateRequest): SendEmailWithTemplateResponse
fn (request: SendEmailWithTemplateRequest, opts: Map): SendEmailWithTemplateResponse

Send an email using a pre-defined Postmark template, identified by TemplateId or TemplateAlias.

Example

// Name the template by TemplateAlias or TemplateId
sent ::postmark::send/send-email-using-template({
    TemplateAlias: "welcome",
    TemplateModel: {name: "Ada"},
    From: "sender@example.com",
    To: "ada@example.com"
})
sent.MessageID

send-single-email

fn (request: SendEmailRequest): SendEmailResponse
fn (request: SendEmailRequest, opts: Map): SendEmailResponse

Send a single email via the Postmark API.

Example

response ::postmark::send/send-single-email(::postmark::send/SendEmailRequest({
    From: "sender@example.com",
    To: "recipient@example.com",
    Subject: "Welcome!",
    TextBody: "Plain text body.",
    HtmlBody: "<html><body><p>HTML body</p></body></html>"
}))
response.MessageID // => "unique-message-id"
response.ErrorCode // => 0

Types

AttachmentCollection

AttachmentCollection type Vec<Map>

EmailWithTemplateRequest

EmailWithTemplateRequest type {
    TemplateId: Int?,
    TemplateAlias: Str?,
    TemplateModel: Map,
    InlineCss: Bool?,
    From: Str,
    To: Str,
    Cc: Str?,
    Bcc: Str?,
    Tag: Str?,
    ReplyTo: Str?,
    Headers: HeaderCollection?,
    TrackOpens: Bool?,
    TrackLinks: "None" | "HtmlAndText" | "HtmlOnly" | "TextOnly"?,
    Attachments: AttachmentCollection?
}

HeaderCollection

HeaderCollection type Vec<Map>

SendEmailBatchRequest

SendEmailBatchRequest type Vec<Map>

SendEmailBatchResponse

SendEmailBatchResponse type Vec<Map>

SendEmailBatchWithTemplatesRequest

SendEmailBatchWithTemplatesRequest type {
    Messages: Vec<EmailWithTemplateRequest>?
}

SendEmailBatchWithTemplatesResponse

SendEmailBatchWithTemplatesResponse type Vec<Map>

SendEmailRequest

SendEmailRequest type {
    From: Str?,
    To: Str?,
    Cc: Str?,
    Bcc: Str?,
    Subject: Str?,
    Tag: Str?,
    HtmlBody: Str?,
    TextBody: Str?,
    ReplyTo: Str?,
    TrackOpens: Bool?,
    TrackLinks: "None" | "HtmlAndText" | "HtmlOnly" | "TextOnly"?,
    Headers: HeaderCollection?,
    Attachments: AttachmentCollection?
}

SendEmailResponse

SendEmailResponse type {
    To: Str?,
    SubmittedAt: Str?,
    MessageID: Str?,
    ErrorCode: Int?,
    Message: Str?
}

SendEmailTemplatedBatchRequest

SendEmailTemplatedBatchRequest type {
    Messages: Vec<EmailWithTemplateRequest>?
}

SendEmailWithTemplateRequest

SendEmailWithTemplateRequest type {
    TemplateId: Int?,
    TemplateAlias: Str?,
    TemplateModel: Map,
    InlineCss: Bool?,
    From: Str,
    To: Str,
    Cc: Str?,
    Bcc: Str?,
    Tag: Str?,
    ReplyTo: Str?,
    Headers: HeaderCollection?,
    TrackOpens: Bool?,
    TrackLinks: "None" | "HtmlAndText" | "HtmlOnly" | "TextOnly"?,
    Attachments: AttachmentCollection?
}

SendEmailWithTemplateResponse

SendEmailWithTemplateResponse type {
    To: Str?,
    SubmittedAt: Str?,
    MessageID: Str?,
    ErrorCode: Int?,
    Message: Str?
}