Email filtering over a VPN: where content rules actually run
A VPN capture does not show the message. Walk the mail path from decapsulation to SMTP TLS to S/MIME, and put the content rule where the data exists.
This request sounds like a network problem: stop a certain kind of attachment from leaving the building, and the VPN is already there, so use it. That framing breaks at the first question the filter has to answer. Content rules need to see the message, and the message becomes visible at a different layer than the tunnel. I walk the mail path outward from the packet and stop at the first place the required data actually exists.
Three layers are independent: the VPN transport, the SMTP TLS connection, and the message's own encryption. Each one ends somewhere different.
Start at the layer that can see the message
VPN decapsulation gives you the inner network traffic. If the mail client opened a TLS connection to a submission server, the inner traffic still contains that TLS stream, not readable mail.
So a packet capture taken at the tunnel edge answers a different question than "does this message contain a prohibited attachment."
SMTP TLS termination ends at the envelope
Terminating SMTP TLS at the mail server exposes the message as submitted to that endpoint. The server sees headers, the envelope, and the MIME structure. That is enough for many content rules. The envelope tells you the sender and recipients as the server understood them.
It is not enough for an S/MIME-protected message. The server receives a protected entity, and without the relevant keys it cannot read the content inside it. The same limit applies to an encrypted attachment that arrives intact.
Do not weaken transport security to make a passive capture readable. That changes the architecture instead of placing the rule where the data is.
S/MIME ends where the keys are
S/MIME protects MIME message data, so its boundary is the key material and the authorized decryption arrangement. A filter without those keys can still act on visible metadata or on the presence of a protected object, but that is a different result.
If the organization runs an authorized encryption gateway or a managed endpoint control, document where plaintext exists, which identity may inspect it, and how keys and records are protected. There is no master key created by routing traffic through a VPN.
Write that down before anyone promises plaintext classification. The promise is the part that is hard to walk back.
Put the rule in the mail platform
If the approved mail server receives the readable message, its supported content-filter integration is the enforcement point. That is different from permitting an SMTP connection through a firewall. That distinction decides whether the rule can reject, quarantine or only annotate.
Postfix, for example, documents after-queue content filtering: mail is queued, passed to a filter, and returned to the delivery path. Its after-queue arrangement is distinct from the before-queue proxy and Milter options the same guide references. Pick the supported integration and failure behavior for the mail service you actually run.
One attachment rule is not a complete data-loss program. Browser uploads, shared storage and endpoint actions need their own controls.
Write the acceptance test with synthetic messages
Test with approved synthetic examples: an allowed message, a prohibited content action, and the declared handling of message-level encryption. Include what the mail service does when its filter is unavailable.
The useful result names the action, the enforcement point, and the data visible there. "The VPN decrypted it" answers one layer and cannot substitute for the mail application's content and authorization model.