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:
- the server is not suspended;
- every mailbox in From, and the Sender if there is one, is at a verified domain of the server's organisation;
- the envelope sender (
MAIL FROM, or the API'smail_from) is empty or at such a domain. An empty sender is accepted only for an automatic reply:auto_reply: trueon a raw send, withmail_fromempty or left out, andAuto-Submitted: auto-repliedorauto-generatedin 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
| Limit | Value | Where |
|---|---|---|
| Requests per minute per API key | the key's rate_limit_per_minute, default 600 | all HTTP APIs; 429 with Retry-After |
| Messages per minute per SMTP credential | the credential's rate_limit_per_minute, default 600 | at MAIL FROM; 450 4.7.1 |
| Delivery attempts per minute per server | the server's send_limit_per_minute, default none | delivery waits a minute and tries again; nothing is refused |
| Connections at once and recipients per minute per destination | KARTA_OUTBOUND_DESTINATION_LIMITS or the IP pool's own, default none | delivery waits; see Delivery |
| Recipients per day from a sending address in its warm-up | the address's warm-up plan | delivery uses another address or waits; see IP pools |
| Message size over SMTP | 25 MiB | 552 5.3.4 |
| Recipients per SMTP message | 100 | 452 4.5.3 (the client sends the rest in another message) |
| To, Cc and Bcc addresses per message built by an API | 50 each (Mailgun and SendGrid: 1000) | API error |
Recipients of /api/v2/messages/raw | 150 | 422 |
| Messages per batch (Mailgun recipient variables, SendGrid personalizations) | 1000 | API error |
| Request body, Mailgun-compatible API | 25 MiB | |
| Request body, SendGrid-compatible API | 30 MiB, also after gzip decompression | 413 |
| Header block | 1 MiB | |
| Tags per message | 10, each 1 to 128 bytes | |
| Variables per message | 16 KiB as JSON | |
| Scheduled sending | at 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.