@ptkl/sdk - v1.3.4
    Preparing search index...

    SDK client for the Protokol Mail integration.

    Provides methods to send emails, list email logs, resend failed emails, and manage attachments through the Protokol Mail API.

    import { Mail } from "@ptkl/sdk"

    const mail = new Mail()

    // Send an email
    const result = await mail.send({
    to: ["user@example.com"],
    subject: "Hello",
    body: "<h1>Welcome!</h1>"
    })

    console.log(result.message_id)

    Hierarchy (View Summary)

    Index

    Constructors

    • Parameters

      • Optionaloptions: { env?: string; host?: string; token?: string }

      Returns default

    Properties

    client: AxiosInstance
    env: null | string = null
    host: null | string = null
    token: null | string = null

    Methods

    • Download an attachment's binary content.

      Parameters

      • messageId: string

        The UUID of the email message

      • attachmentId: string

        The UUID of the attachment

      Returns Promise<ArrayBuffer>

      The raw binary data as an ArrayBuffer

    • Get a single email by its message ID.

      Parameters

      • messageId: string

        The UUID of the email message

      Returns Promise<MailLog>

      The full email log entry

    • List emails for the current project with optional filtering and pagination.

      Parameters

      • Optionalparams: ListEmailsParams

        Optional query parameters for filtering and pagination

      Returns Promise<EmailListResponse>

      Paginated list of email log entries

    • List attachment metadata for a specific email.

      Parameters

      • messageId: string

        The UUID of the email message

      Returns Promise<AttachmentMeta[]>

      Array of attachment metadata entries

    • Resend a previously failed email.

      Parameters

      • messageId: string

        The UUID of the email to resend

      Returns Promise<SendEmailResponse>

      Confirmation with the message ID

    • Parameters

      • client: AxiosInstance

      Returns default