Docs /Wrangler

Email replies

With email replies on, a customer can answer a Wrangler email from their inbox and the answer lands on the ticket, exactly as if they had used the reply form. It is off by default because it needs one piece of setup outside ExpressionEngine: a mailbox whose mail is handed to Wrangler.

How it works

Every email a customer receives — the acknowledgement and each staff reply — goes out with a Reply-To like this:

support+wr42-1f3a9c0d2b7e6a15@example.com

The part after the + names the ticket and carries a signature made from your site's encryption key. It cannot be guessed, and changing the number breaks the signature, so nobody can aim a reply at someone else's ticket.

When the reply arrives, Wrangler:

  1. finds that address among the recipients and checks the signature;
  2. drops it if it is an out-of-office, a bounce, or other automatic mail;
  3. cuts off the quoted copy of the original email, using the "Reply above this line" marker at the top of every customer email and the usual "On … wrote:" lines;
  4. adds what is left to the ticket as the customer, reopens a Pending or Closed ticket, and emails staff, just like a reply from the web form.

A reply from a different address than the one on the ticket is still kept, but as an internal note marked with the sender, so nothing reaches the customer-facing thread from an address Wrangler did not write to. Copy anything useful from it into a real reply.

Images attached to an emailed reply are not imported. The customer can add them from the link in the same email.

Setting it up

  1. Choose a mailbox on your own domain, such as support@example.com, that accepts plus addressing (support+anything@example.com is delivered to support@). Most providers do; cPanel, Fastmail, Google Workspace, Postmark and Mailgun all do.
  2. Connect it to the webhook URL on the settings page (Settings → Email replies). It includes a secret key, so treat it like a password.
  3. Turn on Let customers reply by email and enter the mailbox as the Reply mailbox.
  4. Send yourself a test ticket and reply to the acknowledgement.

Do step 3 last. With the switch on and nothing connected, customer replies go to a mailbox nobody reads.

Connecting a mail provider

Wrangler recognises each of these formats automatically. Point the provider's inbound webhook at the URL from the settings page.

Provider Where
Postmark Servers → Inbound stream → Webhook URL. Postmark's inbound address supports plus addressing, and its MailboxHash is read too.
Mailgun Receiving → Create route → Forward to the URL. The parsed or the mime form both work.
SendGrid Settings → Inbound Parse. "Send raw" on or off both work.

Piping from your own mail server

To deliver from a mailbox on your own server, pipe the raw message to the URL with curl. In cPanel, add a forwarder for the mailbox that pipes to a program, and use a small script:

#!/bin/sh
curl -s --max-time 30 --data-binary @- -H "Content-Type: message/rfc822" "PASTE-THE-WEBHOOK-URL-HERE" > /dev/null

With Postfix or Exim the same command works as the delivery command for an alias. Mail that is piped is never stored by Wrangler apart from the reply text it adds to the ticket.

What the endpoint answers

The endpoint always answers 200 with a short JSON status once the key is right — added, noted, ignored or rejected, and a reason. Mail providers retry anything that is not a 2xx, and mail Wrangler has decided not to take does not get better by being sent again. A wrong key is a 403. Rejections are written to the developer log.

Turning it off

Switch it off and new emails go out without the plus address. Replies to older emails still arrive at the webhook while it is connected, and are refused with a log line until it is switched back on.