Preview: SendMock has no stable release yet. These docs follow develop.
SendMock
Recipes

Reply by email

Answer a notification email as its recipient and have the reply posted to your app, as Mailgun Routes would.

Try it in the demo.

The situation: your app emails ticket updates from reply+<ticket>@reply.app.test, and people answer by email. In production, Mailgun receives the reply and posts it to your app. You want to test that handler locally.

You need: your app's inbound mail handler URL.

Steps

  1. In Settings > Email, add reply.app.test to Inbound domains and save.
  2. In Webhooks > Inbound routes, press Add route. Description "Ticket replies"; Match recipient with the pattern reply\+(?P<ticket>.+)@reply.app.test.
  3. The route starts with a Forward to URL action: set its target to your handler's URL. Then Add action > Stop, and press Add route.
  4. In your app, trigger a ticket notification. Open it in Mail, press Reply (R), write "Thanks, that fixed it." above the quoted text, and press Send reply.
  5. Your handler gets Mailgun's form post. stripped-text holds only "Thanks, that fixed it.", and the ticket id is in the recipient.

In your code

A test that answers a ticket notification as its recipient; the inbound route posts the reply to your handler.

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.

# In your app: email the ticket update to [email protected]

email=$(sendmock email wait --to [email protected] --timeout 10s --json)

reply=$(sendmock email reply "$(jq -r '.id' <<<"$email")" --body 'Thanks, that fixed it.' --json)

jq -e '.direction == "inbound"' <<<"$reply" >/dev/null

What you should see

The reply in Mail with an Inbound badge, its Timeline saying "Forwarded by route Ticket replies to ...", and the request in Webhooks > Deliveries.

Try it in the demo

  1. Open Mail and click Your verification code.
  2. Press Reply, type Got it, thanks. and press Send reply.
  3. Press Open on the toast, then the Timeline tab: it shows "Forwarded by route Replies to no-reply to http://localhost:8000/webhooks/mail/inbound (200)".

Next

On this page