Rules
Rules watch your mail stream so you don’t have to. Each rule is a when / if / then sentence — when a mail arrives, if it matches your conditions, then act on it — built visually in the console under Rules. The engine unlocks on Team plans and up, with the full rule vocabulary from Business (Plans & add-ons).
A few real shapes:
- If the subject contains
[staging], pause the mail — a seatbelt against test blasts escaping to customers. - If the recipient domain is
gmail.com, route through Amazon SES — provider steering by audience. - If an attachment is bigger than 10 MB, reject — policy at the gateway instead of in every app.
- If the mail is tagged
invoice, BCC the bookkeeping inbox.
Scopes
Section titled “Scopes”A rule lives at one of three levels, evaluated in this order:
| Scope | Applies to | Managed by |
|---|---|---|
| Platform | everyone (Mailway’s own safety rules) | read-only |
| Team | every project in your team | team admins |
| Project | one project | admins & developers |
Within a scope, rules run in the priority order you set (drag to reorder). A stop action halts the chain for that mail.
When — the trigger
Section titled “When — the trigger”- On receipt — the moment Mailway accepts the mail. Envelope-level facts (sender, recipients, size) are available.
- After parsing — once the message is parsed. Content conditions (subject, body, headers, attachments) match here.
The console picks the right trigger for the conditions you choose.
If — conditions
Section titled “If — conditions”| Condition | Matches on |
|---|---|
subject_contains / subject_matches |
subject substring / regex |
body_contains / body_matches |
body substring / regex |
from_email_is / from_domain_is |
exact sender / sender domain |
recipient_email_in / recipient_domain_in / recipient_domain_not_in |
recipient allow/deny sets |
recipient_count_gt |
more than N recipients |
header_present / header_value_is |
a header exists / equals a value |
attachment_count_gt / attachment_filename_matches |
attachment count / filename pattern |
size_gt / size_lt |
message size |
tag_present |
a tag set by the API or an earlier rule |
ingest_type_is / ingest_host_in |
how the mail entered (SMTP, API, console) / through which host |
Multiple conditions AND together.
Then — actions
Section titled “Then — actions”On any mail (state and envelope only — the relayed bytes stay untouched):
| Action | Effect |
|---|---|
pause |
hold the mail until someone releases it in the console |
reject |
stop it permanently, with a reason |
route_provider |
pin the send to specific provider(s) |
tag / untag |
label the mail (searchable, echoed on webhooks) |
add_bcc |
add a blind recipient to the envelope |
stop |
halt rule processing for this mail |
On API-submitted mail only (these modify content, which would break the byte-for-byte promise on relayed SMTP messages):
| Action | Effect |
|---|---|
add_cc / redirect_to |
add a visible recipient / replace all recipients |
prepend_subject |
prefix the subject, e.g. [STAGING] |
add_header / set_reply_to |
set a header / the reply-to |
inject_unsubscribe |
add List-Unsubscribe (+ one-click) headers |
generate_text_part |
synthesize a text/plain part from the HTML |
Observability
Section titled “Observability”Every rule shows its match history — which mails it touched, when, and what each action did. Rule edits are versioned and written to the team’s audit log, so “why was this mail paused?” always has an answer.