Inbound email
Receive email in your app the way Postmark, SendGrid or Mailgun posts it, with a built-in template and a rule.
Try it in the demo.
The situation: your app receives email through a provider's inbound webhook: support tickets from support@, invoices from a mailbox, replies. You want to test the handler with the provider's real payload, without a public URL.
You need: your app's inbound handler URL, for example http://localhost:8000/webhooks/postmark-inbound.
Steps
- In Webhooks > Templates, open the Email providers tab and click Postmark: inbound (or SendGrid Inbound Parse, or Mailgun routes).
- Press Use in new endpoint. The endpoint sheet opens with the template chosen. Name it "Postmark inbound", set your handler's URL and press Add endpoint.
- In Webhooks > Rules, press Add rule. Name it "Support inbox", pick the endpoint, tick
email.received, and add a condition To matchessupport@*. Press Add rule. - Send an email to
[email protected](from your app, or with any mail client pointed at127.0.0.1:1025).
In your code
A test that sends an email to the support inbox and checks it was posted to your inbound handler in Postmark's format.
The examples call SendMock's REST API with each language's usual HTTP client and test framework. JavaScript, Go, Java, Rust, Ruby and C# use the small call helper shown under Test helper on their page in Connect your app.
sendmock email send --from 'Sam <[email protected]>' --to [email protected] --subject 'Order arrived damaged' --text 'The box was crushed, can I get a replacement?'
delivery=$(sendmock webhook deliveries wait --endpoint 'Postmark inbound' --event email.received --timeout 10s --json)
jq -e '.status == "succeeded"' <<<"$delivery" >/dev/nullWhat you should see
A delivery in Webhooks > Deliveries whose request body is Postmark's inbound JSON (From, To, Subject, TextBody, HtmlBody, Attachments, ...), and your app's answer beside it. Your app created the ticket.
Try it in the demo
- Open Webhooks > Templates, the Email providers tab, and click Postmark: inbound.
- Press Use in new endpoint. Name it
Postmark inbound, set the URL tohttp://localhost:8000/webhooks/postmark-inboundand press Add endpoint. - The endpoint appears in Endpoints with the Postmark template.