How to Auto-Acknowledge Emailed Customer Inquiries with a Mailhook and Send Email
Give customers a dedicated intake address that logs every inbound inquiry to MongoDB and replies instantly with an AI-drafted acknowledgement, all without touching a mailbox.
What This Integration Does
When customers email questions to a shared inbox, the slowest part of support is often the silence between "I sent it" and "someone read it." This Spojit workflow closes that gap. You give out a unique intake address; every message that lands on it starts a run within seconds, gets recorded in a MongoDB collection so nothing is ever lost, and triggers an immediate, polite acknowledgement back to whoever wrote in. The sender knows their inquiry arrived and roughly what happens next, while your team gets a clean, queryable log of everything that came through.
The run model is push-based and asynchronous. Spojit generates a <prefix>-<random>@mailhook.spojit.com address; any mail sent to it (To, Cc, or Bcc) fires the workflow, with no OAuth and no mailbox to connect. The full message is available as {{ input }}. The workflow inserts one document per inquiry into MongoDB, then uses a Connector node in Agent mode to draft a short acknowledgement, and finally a Send Email node replies to the address in {{ input.replyTo }}. Because the Mailhook trigger is always async, there is no reply to the original SMTP sender other than the email your workflow explicitly sends. Each message is deduplicated, so a re-delivered copy will not double-log or double-reply.
Prerequisites
- A MongoDB connection added in Spojit (Connections → Add connection), with write access to the database and a collection (for example
inquiries) where each inbound message will be stored. - A forwarding rule, contact-form handler, or vendor notification you can point at the Mailhook address (this is the address you will publish or forward to).
- Sender addresses you reply to must be reachable; the AI-drafted acknowledgement is sent through Spojit's built-in mail service, which counts toward your monthly email allowance.
- If you send acknowledgements to addresses outside your organization, confirm the org email allowlist under Settings → General → Email recipients permits them.
Step 1: Add the Mailhook trigger and generate an intake address
Create a new workflow and open the Trigger node. Set Trigger Type to Mailhook. Optionally set an Address prefix (1 to 24 characters, default mh) such as support, then click Generate email address. Spojit produces a unique address like support-a1b2c3d4e5f6g7h8@mailhook.spojit.com. Copy it and publish it on your contact page or set your existing support inbox to forward to it.
To keep noise out, set the optional From allowlist and Subject regex filters. Mail that does not match the filters is ignored and does not start a run. After this step, every matching email exposes its contents as {{ input }}, including {{ input.from }}, {{ input.subject }}, {{ input.text }}, and the reply target list {{ input.replyTo }}.
Step 2: Normalize the sender's reply address with a Transform node
The Mailhook output gives replyTo as a list (it can be empty if the message had no Reply-To header). Add a Transform node to pick a single, safe recipient: use the first entry of {{ input.replyTo }} when present, and fall back to the first entry of {{ input.from }} otherwise. Save the result to a variable such as customerEmail so the rest of the workflow has one clean value to reference.
This keeps your Send Email recipient field simple and avoids accidentally emailing an empty or multi-value field. If you prefer, you can compute the same value with the code connector's execute-javascript tool, returning a single string.
Step 3: Log the inquiry to MongoDB
Add a Connector node, choose your MongoDB connection, and run it in Direct mode with the insert-documents tool. Set collection to inquiries and map documents to a single-element array describing this message. A deterministic insert here means no AI cost and a guaranteed, structured record of every inquiry.
{
"collection": "inquiries",
"documents": [
{
"messageId": "{{ input.messageId }}",
"from": "{{ input.from }}",
"replyTo": "{{ customerEmail }}",
"subject": "{{ input.subject }}",
"body": "{{ input.text }}",
"receivedAt": "{{ input.receivedAt }}",
"status": "acknowledged"
}
]
}
The tool returns {{ step.data.insertedCount }} and the generated ids under {{ step.data.insertedIds }}, which you can reference downstream if you want to include a ticket-style identifier in the reply. Storing messageId lets you find or de-duplicate records later.
Step 4: Draft the acknowledgement with a Connector node in Agent mode
Add a second Connector node in Agent mode. Agent mode lets the agent read the inquiry and write a tailored, on-brand acknowledgement rather than sending a rigid form letter. Provide a prompt that names the customer and references their subject, and attach a Response Schema so the output is reliable structured JSON you can map into the email.
Write a brief, warm acknowledgement email to a customer who just sent
a support inquiry. Do not attempt to solve their problem; only confirm
receipt and set expectations for a reply within one business day.
From: {{ input.from }}
Subject: {{ input.subject }}
Message: {{ input.text }}
Return JSON: { "subject": string, "body": string }
With a Response Schema of { "subject": "string", "body": "string" }, the node yields {{ step.subject }} and {{ step.body }} for the next step. Keep the prompt scoped to "confirm receipt only" so the acknowledgement never over-promises an answer.
Step 5: Reply to the sender with a Send Email node
Add a Send Email node. Set Recipients to {{ customerEmail }} from Step 2, Subject to {{ step.subject }} from the Agent-mode draft (or a fixed "We received your message" if you prefer), and Body to {{ step.body }}. Leave Reply-To as the default workflow owner so any customer reply routes to your real support address. Set If sending fails to Continue anyway if you would rather keep the MongoDB log even when an address bounces, or Fail the workflow to surface delivery problems in the run history.
This node sends from Spojit's built-in mail service with no connection required and counts toward your monthly email allowance. If you need the acknowledgement to come from your own domain, swap the Send Email node for a Connector node using the Resend connector's send-email tool or the SMTP connector's send-email tool instead.
Step 6: Save and connect the nodes
Wire the nodes in order: Trigger → Transform → MongoDB Connector → Agent-mode Connector → Send Email. Save the workflow and enable it. If you would rather scaffold this on the canvas quickly, open Miraxa, the intelligent layer across your automation, and describe it in one sentence, for example: "Build a workflow that watches a mailhook, logs each email to MongoDB with insert-documents, drafts an acknowledgement in Agent mode, and replies with Send Email to the sender's reply-to." Miraxa adds and connects the nodes for you, and you fine-tune the fields in the properties panel.
Tips
- Use the
messageIdyou store in MongoDB as a stable key. Because the Mailhook deduplicates per message, a single inquiry produces one document and one reply even if the upstream system retries delivery. - Keep the Agent-mode prompt narrow ("confirm receipt only") to hold down AI credit usage and avoid the workflow accidentally answering the question before a human reviews it.
- Need to rotate the intake address (for example, it leaked to spammers)? Use Regenerate address in the trigger; the old address dies instantly. See the guide on changing your mailhook address below.
- To add a friendly reference number to the reply, template the inserted id from
{{ step.data.insertedIds }}into the email body in Step 5.
Common Pitfalls
- Empty reply target.
{{ input.replyTo }}can be an empty list. Always fall back to{{ input.from }}in Step 2, or the Send Email recipient may resolve to nothing. - Recipient allowlist. If acknowledgements to external customers silently fail, check Settings → General → Email recipients; external addresses must be allowed before the built-in mail service will send to them.
- Treating the acknowledgement as a real answer. Agent mode drafts a receipt confirmation, not a solution. Keep the actual support reply a separate, human step so customers are not misled.
- Long messages get truncated. Very large emails arrive with
{{ input.truncated }}set; rely on the stored MongoDB record for the full context rather than assuming{{ input.text }}is complete.
Testing
Before publishing the address widely, set a temporary From allowlist on the trigger that contains only your own email, then send a test message to the generated Mailhook address. Within seconds the run should appear in execution history; confirm a document landed in your inquiries collection (for example with a find-documents query on messageId), check that the Agent-mode draft looks right, and verify the acknowledgement arrives in your inbox addressed to your reply-to. Once you are happy, widen or remove the allowlist and point your real intake at the address.