Attachment auto-compress lets your gateway automatically repackage selected outgoing attachments into standard ZIP archives while the message is in transit.
The compression is applied before the message is S/MIME-signed, so the signature always covers the final, compressed message.Rules decide which attachments are compressed based on the sender, the recipient, the domain, the file name, the declared and the real (magic-byte) MIME type, and the attachment size.
The feature runs inside the outbound mail pipeline in this order, so a signature — when signing is enabled — is computed over the already-compressed body:
raw message > disclaimer injection > attachment auto-compress > S/MIME signing > delivery
.zip archive that opens natively on Windows, macOS and Linux — no proprietary tooling required.Open SMTP Router > Outgoing rules > auto-compress.
The page is organised in three tabs — Status, Rules and Events — and is scoped to the selected Postfix (MTA) instance.
The Rules tab lists every rule, ordered by priority.

The following fields are available. Empty criteria match everything, and every size is expressed in bytes (0 means « no limit »).
| Field | Meaning |
|---|---|
| Rule Name | A human-readable label shown in the list and the logs. |
| Priority | Rules are evaluated from the highest priority to the lowest; the first matching rule decides the outcome for an attachment. |
| Action | compress zips a matching attachment; bypass explicitly leaves it alone (and stops lower-priority compress rules from acting on it). |
| Pattern Mode | wildcard — the * character means « any string » (for example *.pdf); regex A full regular expression : for example ^application/(msword|vnd\.openxmlformats-officedocument\..*)$). |
| Direction | Restricts the rule to outbound, inbound or both. Outbound submission mail is what the gateway processes today. |
| Sender / Recipient pattern | Match the envelope sender or recipient address against the pattern (wildcard or regex). |
| Sender / Recipient domain | Match the sender or recipient domain exactly (case-insensitive). |
| Attachment filename pattern | Match the attachment file name, for example *.pdf or *.docx. |
| Declared MIME type | Match the Content-Type declared by the mail client. |
| Detected MIME type | Match the real type detected from the file’s leading bytes (magic bytes). This cannot be spoofed by a misleading extension or header. |
| Minimal / MAX Size | Only compress attachments within this size window (in bytes). If the size is unknown, only rules without a size criterion can match. |
| Compression level | 0 stores without compression; 1 (fast) to 9 (smallest) select the DEFLATE effort. 6 is a good default. |
| Archive filename suffix | Suffix appended to the archive name (default .zip). |
| Skip already compressed files | When enabled, attachments detected as ZIP, RAR, 7z or GZIP are left untouched (recommended). |
| Remove original extension | Produce document.zip instead of document.pdf.zip. |
| Enabled | Turn the rule on or off without deleting it. |
report.pdf but that is really a ZIP archive is recognised as an archive.The Status tab summarises the feature at a glance: whether it is active, how many rules are enabled, how many attachments were compressed in the last 24 hours, the average compression ratio and the bandwidth saved.

The Events tab records one line per processed attachment — the action taken (compressed, bypassed, skipped or error), the file name, the sender, the declared and detected MIME types, the original and compressed sizes with the achieved ratio, and the reason when an attachment was skipped. No message body or attachment content is ever stored in the logs.

Use the Test rule button to simulate an attachment without sending any e-mail. Describe a hypothetical sender, recipient and file (name, declared type, detected type and size), then run the test: the console reports which rule would match, the action that would be taken and the exact criteria that matched.

This is the safest way to validate a new policy: confirm it matches the files you expect — and, just as importantly, that it does not match the ones it should leave alone — before switching the rule on in production.
The feature ships with two rules for the default instance: