Sending rules and limits

The same rules apply to every message, whether it arrives over SMTP or one of the HTTP APIs (Karta.SMTP.Policy.Submission, Karta.Sending).

Who may send what

A credential belongs to a mail server, and a server to an organisation. A message is accepted only when:

  1. the server is not suspended;
  2. every mailbox in From, and the Sender if there is one, is at a verified domain of the server's organisation;
  3. the envelope sender (MAIL FROM, or the API's mail_from) is empty or at such a domain. An empty sender is accepted only for an automatic reply: auto_reply: true on a raw send, with mail_from empty or left out, and Auto-Submitted: auto-replied or auto-generated in the message (Delivery).

Domains are compared exactly, in ASCII form: a subdomain is a different domain, and an internationalised domain matches its xn-- form.

The header is checked on parsed addresses (Karta.Mail.Authorisation), never as text. A display name or comment that looks like an address cannot pass for one: From: victim@bank.example (<ann@example.com>) is the mailbox victim@bank.example and is refused. The header must also be well formed:

  • exactly one From field (RFC 5322 ยง3.6);
  • From is a mailbox list (a group is refused);
  • at most one Sender field, holding exactly one mailbox;
  • a From with several mailboxes needs a Sender.

Messages built by an API from its parts (From given as a field) are checked as they will be sent. Messages given whole (SMTP, send/raw, messages/raw, Mailgun's messages.mime) are checked as given.

Limits

LimitValueWhere
Requests per minute per API keythe key's rate_limit_per_minute, default 600all HTTP APIs; 429 with Retry-After
Messages per minute per SMTP credentialthe credential's rate_limit_per_minute, default 600at MAIL FROM; 450 4.7.1
Delivery attempts per minute per serverthe server's send_limit_per_minute, default nonedelivery waits a minute and tries again; nothing is refused
Connections at once and recipients per minute per destinationKARTA_OUTBOUND_DESTINATION_LIMITS or the IP pool's own, default nonedelivery waits; see Delivery
Recipients per day from a sending address in its warm-upthe address's warm-up plandelivery uses another address or waits; see IP pools
Message size over SMTP25 MiB552 5.3.4
Recipients per SMTP message100452 4.5.3 (the client sends the rest in another message)
To, Cc and Bcc addresses per message built by an API50 each (Mailgun and SendGrid: 1000)API error
Recipients of /api/v2/messages/raw150422
Messages per batch (Mailgun recipient variables, SendGrid personalizations)1000API error
Request body, Mailgun-compatible API25 MiB
Request body, SendGrid-compatible API30 MiB, also after gzip decompression413
Header block1 MiB
Tags per message10, each 1 to 128 bytes
Variables per message16 KiB as JSON
Scheduled sendingat most 72 hours ahead

A credential's rate limit is counted in a sliding one-minute window in the database (Karta.Limits), shared by every node: two nodes do not allow twice the limit. The in-memory counters that remain (Karta.RateLimiter: tracking events and MTA-STS fetches) are per node and bounded.

A server's send_limit_per_minute counts delivery attempts of all its mail. When the limit is reached, a delivery job waits 60 seconds and tries again. The wait is not counted as an attempt, but the 5-day retry period keeps running.

Suppressed recipients

Recipients on the server's suppression list are accepted, recorded with the status suppressed, and never delivered to; the message's other recipients are delivered as usual. Refusing them instead would make many clients fail the whole message. See Suppressions.

What Karta does not change

A message given whole is stored as received, with Karta's Received: field in front. At delivery, Karta may add tracking (rewritten links, an open pixel, List-Unsubscribe) when the server has it on, and adds its DKIM signatures. It never rewrites From or other author fields.

A message built from its parts gets the fields Karta writes itself: Date, Message-ID (<message id>@<KARTA_OUTBOUND_HOSTNAME> unless one is given), MIME-Version, the content fields, From, To, Cc, Reply-To and Subject. Those cannot be given again as extra headers; Bcc is used for the envelope and never written into the message.