http-filter
Once an email is received (DATA), the http-filter filter sends a CloudEvent describing it
to an HTTP endpoint, as JSON. A 2xx answer accepts the email for the flow; any other status refuses it.
When to use it
Section titled “When to use it”When the decision needs your own logic: the content of the email, a list of allowed senders kept elsewhere, a quota per user. The endpoint sees the sender, the recipients, the subject, the text and HTML bodies (truncated to 8192 characters), the attachment names and sizes, and the client details, including the authenticated username.
How it fits in a flow
Section titled “How it fits in a flow”- It decides after
DATA, so recipients wait until then: a flow whose only filter ishttp-filteranswers250to everyRCPT TO, and the email is refused with450if the endpoint refuses it and no other flow takes it. See routing. - A
2xxanswer makes the flow take every recipient it has not refused. Combine it with awhitelistonto(AND) to refuse unknown recipients atRCPT TOfirst. - With
allowAnyUser: true, the filter also accepts anyAUTHcommand, whatever the credentials, and leaves the decision to the endpoint, which finds the username indata.server.username. - Requests can be signed with an HMAC, as for http-auth.
Options
Section titled “Options”Example
Section titled “Example”{ "$schema": "https://raw.githubusercontent.com/loopingz/smtp-relay/main/config.schema.json", "flows": { "checked": { "filters": [ { "type": "whitelist", "to": ["regexp:.*@mydomain.com"] }, { "type": "http-filter", "url": "https://filter.example.com/smtp/email", "hmac": { "secret": "change-me" } } ], "outputs": [{ "type": "file", "path": "./received_emails/" }] } }, "bind": "0.0.0.0", "options": { "authOptional": true }}The CloudEvent
Section titled “The CloudEvent”The same CloudEvent is sent by http-filter and published by the pubsub option of the
aws and gcp outputs. Its type is com.loopingz.smtp-relay.v2, its source
the local address of the server, its subject the Message-ID of the email, and its time the time the
connection was opened.
{ "id": "53562c7c-5010-4ba7-af2e-337b0a34aabc", "time": "2026-11-30T09:15:02.117Z", "type": "com.loopingz.smtp-relay.v2", "source": "172.17.0.2", "specversion": "1.0", "subject": "<4f1c2e@mail.example.com>", "data": { "email": { "from": { "value": [{ "address": "alice@example.com", "name": "Alice" }], "html": "…", "text": "\"Alice\" <alice@example.com>" }, "attachments": [{ "filename": "invoice.pdf", "size": 48213 }], "subject": "Invoice 2026-11", "to": { "value": [{ "address": "billing@mydomain.com", "name": "" }], "html": "…", "text": "billing@mydomain.com" }, "text": "Hello,\nplease find the invoice attached.\n", "html": "<p>Hello,</p>…" }, "server": { "clientHostname": "app.example.com", "remoteAddress": "10.0.3.17", "remotePort": 51544, "hostNameAppearAs": "app.example.com", "id": "3ieb2d4f6ng7jgor", "secure": true, "transmissionType": "ESMTPSA", "username": "app" } }}email.from,email.to,email.ccandemail.bccare address objects parsed from the headers. When the email has no From or To header,fromis the envelope sender andtothe envelope recipients. When anhttp-filterran, the field is set once for the whole email, so the outputs’ CloudEvents list every envelope recipient, not only those of their flow; otherwise an output’s CloudEvent lists its flow’s recipients.email.priorityis thePriorityheader, when present.subject,text,html, the attachment file names andserver.clientHostnameare truncated: to 8192 characters by default, topubsub.truncatein the outputs.- Fields without a value (no HTML body, no authenticated user…) are left out.