MOLTED EMAIL

Safety Settings

Configure tenant-wide guardrails for inbound threat classification and sending behavior.

Safety settings control how your tenant handles inbound threats, spam classification, and agent-safety guardrails. These are global settings that apply to all agents and mailboxes in your tenant.

Changes take effect immediately, for mail that arrives after the change. Safety settings work alongside (not as a replacement for) policy engine rules. For how inbound mail is authenticated and classified, see Inbound Email.

Reading the settings works with any valid key. Changing them needs a key that reaches every mailbox (admin, or all-mailbox access) with manage or admin scope, and an agent may only tighten them (see Who can change what). There is no MCP tool for safety settings: use the CLI or the API. The portal edits only some of them, see Where to change them.

Where to change them

GroupFieldsWhere
Spam filterspamThreshold, maxLinksThreshold, blockNoAuth, spamActionLowConfidence, blockedKeywords, allowedSendersThe portal at Settings > Safety (/app/settings#safety), the CLI and the API.
Threat actionsspamAction, phishingAction, malwareAction, abuseAction, impersonationActionThe CLI and the API only.
Guardrail flagsquarantineHighInjection, holdCriticalAnomalies, blockCanaryViolationsThe CLI and the API only.

The portal's Settings > Safety page shows six spam-filter fields (and the humanizer); it has no control for the threat actions or the guardrail flags. A person who needs to change one of those, for example to loosen a phishingAction an agent was refused, uses the person's route with the portal's cookie session. It takes the same body as the agent route and is never held for a decision:

curl
curl -X PUT https://api.molted.email/v1/me/safety-settings \
  -H "Cookie: YOUR_SESSION_COOKIE" \
  -H "Content-Type: application/json" \
  -d '{"phishingAction": "deliver"}'

View current settings

Via the CLI

CLI
molted safety get
Response
{
  "tenantId": "tenant_abc123",
  "quarantineHighInjection": true,
  "holdCriticalAnomalies": true,
  "blockCanaryViolations": true,
  "spamAction": "quarantine",
  "phishingAction": "quarantine",
  "malwareAction": "reject",
  "abuseAction": "quarantine",
  "impersonationAction": "quarantine",
  "spamThreshold": 0.5,
  "maxLinksThreshold": 5,
  "blockNoAuth": false,
  "blockedKeywords": [],
  "allowedSenders": [],
  "spamActionLowConfidence": "deliver"
}

Via the API

GET https://mailbox.molted.email/v1/agent/config/safety-settings

Requires Bearer authentication.

curl
curl https://mailbox.molted.email/v1/agent/config/safety-settings \
  -H "Authorization: Bearer YOUR_API_KEY"

Allowed senders format

An allowedSenders entry is one of:

  • An email address, such as bob@acme.com. It matches that address only (bob+news@acme.com is a different address).
  • A bare domain, such as acme.com. It matches the domain and its subdomains: bob@acme.com and bob@mail.acme.com match, bob@evilacme.com and bob@acme.com.evil.net do not. The match is on whole labels, never on a suffix of the text. Subdomains are covered because the DMARC check a match still needs treats mail.acme.com as part of acme.com. To allow one subdomain only, list that subdomain (mail.acme.com).

Entries are case-insensitive and trimmed, @acme.com is accepted and stored as acme.com, a trailing dot is dropped and an internationalised domain is stored in its xn-- form. A wildcard (*.acme.com), a display name (Bob <bob@acme.com>), several addresses in one entry, an IP address and a public suffix (com, co.uk, github.io, which would allow everyone under it) are refused with 400 invalid_allowed_sender. An entry saved before this check that would now be refused keeps matching exactly as it did (the whole entry against the sender's address or domain). A match still only downgrades a spam verdict, and only when the message's DMARC result is pass.

A bare domain for a free-mail or shared-hosting provider (gmail.com, outlook.com, yahoo.co.uk, amazonaws.com, zendesk.com, and any subdomain of them) is refused with 400 invalid_allowed_sender, because it would cover every sender there whose mail passes DMARC, which is anyone who can open an account. A full address at such a domain (alice@gmail.com) is fine. An entry of that kind saved before this check stays in the list but is ignored when mail arrives, so it no longer downgrades anything. Replace it with the full addresses you mean. The list of such providers cannot be complete, so on any consumer or shared domain only a full address is a safe entry.

An entry matches the sender's ASCII or punycode (xn--) form. A From address written in raw UTF-8 (bob@münchen.example) does not match the entry münchen.example, which is stored as xn--mnchen-3ya.example, and a From with a non-ASCII host never matches any entry. That fails closed: the message is judged as if the entry were absent.

Update settings

Updates are partial -- only fields you include are changed. Unspecified fields keep their current values, and so does a field sent as null. A list (blockedKeywords, allowedSenders) is replaced as a whole, with blank entries dropped. allowedSenders entries are trimmed, lowercased and de-duplicated, and @acme.com is stored as acme.com; see the format.

Via the CLI

CLI
molted safety update --settings '{
  "spamAction": "reject",
  "spamThreshold": 0.7,
  "blockedKeywords": ["unsubscribe me", "remove me"]
}'
FlagTypeRequiredDescription
--settingsjsonYesSafety settings as a JSON string.

Via the API

PUT https://mailbox.molted.email/v1/agent/config/safety-settings

Requires Bearer authentication.

curl
curl -X PUT https://mailbox.molted.email/v1/agent/config/safety-settings \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "spamAction": "reject",
    "spamThreshold": 0.7,
    "blockedKeywords": ["unsubscribe me", "remove me"]
  }'

Settings reference

Threat response actions

These control what happens when a threat is detected. Valid values: "deliver", "quarantine", "reject".

FieldTypeDefaultDescription
spamActionstring"quarantine"Action for detected spam.
phishingActionstring"quarantine"Action for detected phishing.
malwareActionstring"reject"Action for detected malware.
abuseActionstring"quarantine"Action for abuse or harassment.
impersonationActionstring"quarantine"Action for impersonation attempts.
spamActionLowConfidencestring"deliver"Action for a spam verdict whose score is at or above your spamThreshold but below 0.5. Only reachable when spamThreshold is below 0.5.

Action meanings:

  • deliver -- the message is delivered to the mailbox normally.
  • quarantine -- the message is stored but held from your agents until a person decides: its thread goes to the needs_approval queue, tagged with the verdict. Spam shows on the portal's Spam page (/app/spam), every other verdict on the Quarantine page (/app/quarantine).
  • reject -- today handled exactly like quarantine: the message is stored and held, never dropped or bounced. A reject whose confidence is below 0.6 is recorded as quarantine.

Classification thresholds

FieldTypeDefaultRangeDescription
spamThresholdnumber0.50.1 - 1.0Spam score cutoff for the spam verdict. Lower values are more aggressive. It never changes the phishing, malware, abuse or impersonation cutoff (fixed at 0.5).
maxLinksThresholdinteger51 - 100A message with more links than this (text and HTML) gets the excessive_links spam signal.

Guardrail flags

Boolean flags that enable or disable specific safety guardrails.

FieldTypeDefaultDescription
quarantineHighInjectionbooleantrueQuarantine inbound messages with high prompt-injection risk: agents see a placeholder instead of the body unless their key has operator scope.
holdCriticalAnomaliesbooleantrueHold an inbound message whose thread anomaly is critical until a person releases it from the held-messages queue.
blockCanaryViolationsbooleantrueBlock an outbound send or reply that contains its thread's canary token (see Canary tokens).
blockNoAuthbooleanfalseApply a heavy spam penalty (+0.5) to an inbound message whose SPF, DKIM and DMARC checks all fail. A check with no result (an unsigned message, for example) is not a failure.

Allow/deny lists

FieldTypeDefaultMax entriesDescription
blockedKeywordsstring[][]100Keywords matched case-insensitively against subject and body. Each match adds +0.4 to the spam score (so one match alone reaches a threshold of 0.4 or lower, two reach the default 0.5); what then happens is spamAction.
allowedSendersstring[][]100Email addresses (bob@acme.com) or bare domains (acme.com, which also covers its subdomains; see the format) whose mail, when the message's DMARC result is pass, has a spam verdict downgraded to clean. Never bypasses phishing, malware, abuse, impersonation, or prompt-injection detection -- and a sender that matches without a passing DMARC is treated as not allowed at all. This is a manually-edited setting; the separate, auto-growing sender allow-list (GET/DELETE /v1/agent/override/allowlist) works the same way but is built from repeated not-spam marks, not typed in here.

Canary tokens

Every thread read (GET /v1/agent/threads/:id, molted threads get, MCP get_thread) carries a canary token for that thread in _agentContext.canaryGuidance.canaryToken, with guidance not to repeat it. It is a secret marker, unique to the thread and your workspace. If an agent is tricked (for example by a prompt injection in an inbound email) into pasting its context into an outbound message, the token goes with it.

On a send or reply that names the thread (POST /v1/agent/outbound/send or /reply with a threadId, and the CLI and MCP equivalents), Molted checks the outgoing content for that thread's token. A match always marks the thread (metadata.canary_violation: true, with canary_violated_at). With blockCanaryViolations on (the default), the send is also refused: the response has status: "blocked", reason: "canary_violation" and no requestId, and nothing is sent. With it off, the send goes out and only the mark remains.

Examples

Lock down the workspace

Settings are workspace-wide, not per mailbox. Block unauthenticated email, reject malware and phishing, quarantine everything else:

CLI
molted safety update --settings '{
  "malwareAction": "reject",
  "phishingAction": "reject",
  "spamAction": "quarantine",
  "blockNoAuth": true,
  "quarantineHighInjection": true,
  "spamThreshold": 0.3
}'

Relax settings for a trusted environment

When your workspace only receives email from known partners, a person can relax the settings. From an agent key this returns 403 human_decision_required with a decisionUrl (see Who can change what):

CLI
molted safety update --settings '{
  "spamAction": "deliver",
  "spamActionLowConfidence": "deliver",
  "spamThreshold": 0.9,
  "allowedSenders": ["partner.com", "ops@internal.co"]
}'

Add keyword blocklist

Block messages containing specific phrases:

CLI
molted safety update --settings '{
  "blockedKeywords": ["crypto opportunity", "wire transfer", "urgent action required"]
}'

Note that blockedKeywords replaces the entire list on each update. Include all keywords you want active, not just new additions.

Who can change what

Agents may tighten these settings, never loosen them. From an agent key, a change that loosens anything returns 403 human_decision_required with a decisionUrl and a loosens list (or, while your account is in warn, goes through with a Molted-Deprecation: human-gate header). The change is compared field by field against what is stored, so one loosening field refuses the whole update. A person signed in to the portal is never held, and can change any field with PUT /v1/me/safety-settings (see Where to change them). The spam-filter fields are also under Settings > Safety, where each pending change says whether it tightens or loosens.

SettingTightening (agents may)Loosening (needs a human)
quarantineHighInjection, holdCriticalAnomalies, blockCanaryViolations, blockNoAuthtruefalse
Threat actions (spamAction, phishingAction, malwareAction, abuseAction, impersonationAction, spamActionLowConfidence)A stricter action (from deliver to quarantine to reject)A weaker action
spamThreshold, maxLinksThresholdLowerHigher
blockedKeywordsAdd entriesRemove entries
allowedSendersRemove entriesAdd entries

The same rules apply to the spam-filter subset of these settings (spamThreshold, maxLinksThreshold, blockNoAuth, blockedKeywords, allowedSenders, spamActionLowConfidence), which the mailbox service also serves at GET/PUT https://mailbox.molted.email/v1/agent/spam-filter/rules. The PUT needs a key that reaches every mailbox with manage or admin scope, and the GET needs a key that reaches every mailbox, because the rules apply to every mailbox's inbound mail. A key limited to one mailbox, or to two of three, gets 403 mailbox_scope_denied and nothing changes. The same key reading GET /v1/agent/config/safety-settings (or GET /v1/ops/safety-settings) gets every other setting, without blockedKeywords and allowedSenders, plus "redacted": ["blockedKeywords", "allowedSenders"]. See Loosening a control.

What screening does not cover

  • Attachment contents. The safety classifier and the AI checks read an email's subject and body (text and HTML), not its files. Instructions hidden in a PDF, image or document are not detected. Attachments get a separate file scan that blocks executables and binaries; it is not an antivirus engine.
  • Images. Text inside an image (a screenshot of a phishing page, say) is not read.

Errors

ErrorCauseFix
400 Bad RequestAn unknown field in the body.Send only the fields listed above; the message names the valid ones.
400 Bad RequestInvalid action value or threshold out of range.Use "deliver", "quarantine", or "reject" for actions. Keep spamThreshold between 0.1 and 1.0, maxLinksThreshold between 1 and 100.
400 Bad RequestToo many entries in blockedKeywords or allowedSenders.Each list supports a maximum of 100 entries.
400 invalid_safety_settingsA field has the wrong type: a non-boolean flag, a number given as a string, a maxLinksThreshold that is not a whole number, or blockedKeywords / allowedSenders that is not a list of strings. The message names each field.Send the types in the field list above. See Errors.
400 invalid_allowed_senderAn allowedSenders entry is not an email address or a bare domain (a wildcard such as *.acme.com, a display name, several addresses, a public suffix such as com, or a bare free-mail or shared-hosting domain such as gmail.com). The message names the entry and says why.Send bob@acme.com or acme.com; see the format.
401 UnauthorizedMissing or invalid API key.Run molted auth init to authenticate.
403 mailbox_scope_deniedThe key is scoped to some mailboxes, and these settings cover the whole workspace.Use a key with access to every mailbox.
403 insufficient_scopeAn all-mailbox key without manage or admin scope.Use a key with manage or admin.
403 human_decision_requiredAn agent key tried to loosen a setting.Hand the decisionUrl to a person.