import z from"@contractspec/lib.ui-link";import{ChevronRight as A}from"lucide-react";import{jsx as f,jsxs as q}from"react/jsx-runtime";function E(){return q("div",{className:"space-y-8",children:[q("div",{className:"space-y-4",children:[f("h1",{className:"font-bold text-4xl",children:"Postmark"}),f("p",{className:"text-muted-foreground",children:"Postmark is a transactional email service with industry-leading deliverability. Use it to send order confirmations, password resets, notifications, and other critical emails."})]}),q("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Setup"}),f("p",{className:"text-muted-foreground",children:"Add your Postmark credentials to your environment variables:"}),f("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:f("pre",{children:`# .env
POSTMARK_API_TOKEN=...
POSTMARK_FROM_EMAIL=noreply@example.com
POSTMARK_FROM_NAME="Your App Name"`})}),q("p",{className:"text-muted-foreground text-sm",children:["Get your API token from the"," ",f("a",{href:"https://account.postmarkapp.com/servers",target:"_blank",rel:"noopener noreferrer",className:"text-violet-400 hover:text-violet-300",children:"Postmark Dashboard"}),"."]})]}),q("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Sending emails"}),f("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:f("pre",{children:`capabilityId: send-email
provider:
  type: postmark
  operation: sendEmail

inputs:
  to:
    type: string
    description: "Recipient email address"
  subject:
    type: string
  htmlBody:
    type: string
    optional: true
  textBody:
    type: string
    optional: true
  templateId:
    type: string
    optional: true
  templateData:
    type: object
    optional: true

outputs:
  messageId:
    type: string
  submittedAt:
    type: timestamp`})})]}),q("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Using templates"}),f("p",{className:"text-muted-foreground",children:"Postmark templates allow you to design emails in their dashboard and populate them with data:"}),f("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:f("pre",{children:`capabilityId: send-welcome-email
provider:
  type: postmark
  operation: sendEmail

inputs:
  to:
    type: string
  userName:
    type: string

config:
  templateId: "welcome-email"
  templateData:
    user_name: \${input.userName}
    login_url: "https://app.example.com/login"`})})]}),q("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Webhooks"}),f("p",{className:"text-muted-foreground",children:"Postmark can notify your app about delivery, bounces, and opens:"}),f("div",{className:"overflow-x-auto rounded-lg border border-border bg-background/50 p-4 font-mono text-muted-foreground text-sm",children:f("pre",{children:"https://your-app.com/api/webhooks/postmark"})}),f("p",{className:"text-muted-foreground",children:"ContractSpec automatically processes these webhook events:"}),q("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[q("li",{children:[f("strong",{children:"Delivery"})," – Email was successfully delivered"]}),q("li",{children:[f("strong",{children:"Bounce"})," – Email bounced (hard or soft)"]}),q("li",{children:[f("strong",{children:"SpamComplaint"})," – Recipient marked email as spam"]}),q("li",{children:[f("strong",{children:"Open"})," – Recipient opened the email"]}),q("li",{children:[f("strong",{children:"Click"})," – Recipient clicked a link"]})]})]}),q("div",{className:"space-y-4",children:[f("h2",{className:"font-bold text-2xl",children:"Best practices"}),q("ul",{className:"list-inside list-disc space-y-2 text-muted-foreground",children:[f("li",{children:"Use templates for consistent branding"}),f("li",{children:"Always provide both HTML and plain text versions"}),f("li",{children:"Monitor bounce rates and remove invalid addresses"}),f("li",{children:"Use message streams to separate different email types"}),f("li",{children:"Test emails in the Postmark sandbox before going live"}),f("li",{children:"Set up DKIM and SPF records for your domain"})]})]}),q("div",{className:"flex items-center gap-4 pt-4",children:[f(z,{href:"/docs/integrations/stripe",className:"btn-ghost",children:"Previous: Stripe"}),q(z,{href:"/docs/integrations/resend",className:"btn-primary",children:["Next: Resend ",f(A,{size:16})]})]})]})}export{E as IntegrationsPostmarkPage};
