Skip to main content

Block message

Block message action

Block message action allows blocking email messages during SMTP transactions. When a milter decides to block a message, it returns specific response codes to control Postfix's behavior.

Below is a summary of key response codes for blocking messages, their descriptions, effects on the message, and example use cases.

FieldDescription
Type
  • discard
  • reject
  • tempfail
  • custom
RCODESMTP response code (e.g. 550 for reject, 450 for tempfail). Available with custom type.
XCODEEnhanced status code (e.g. 5.7.1 for security reject, 4.7.1 for temp). Available with custom type.
MessageThe text message returned to the SMTP client explaining why the email was blocked. Example: "Message rejected - Spam detected". Available with custom type.

Block message types

Discard

Silently accepts and discards the message. Message is accepted (no SMTP error to client) but never delivered. No explicit Postfix log; treated as accepted.

Reject

Instructs Postfix to issue a permanent 5xx SMTP error, rejecting the message. The message is discarded; the client is told not to retry.

Postfix logs it as milter-reject.

Tempfail

Issues a temporary 4xx SMTP error, deferring the message. Client may retry later; Postfix queues if retries exceed limits.

Postfix logs it as milter-reject.

Custom

Common examples of custom block messages:

RCODEXCODEMessageUse Case
5505.7.1"Message rejected: Sender not authorized"Unauthorized sender domain
5545.6.0"Message rejected: Message size too large"Oversized attachments
4514.7.1"Message deferred: Rate limit exceeded"Too many messages from sender
5505.7.0"Message rejected: Policy violation detected"Content policy violation
4214.3.0"Service temporarily unavailable, try later"System maintenance or resource limits

Best practices

  • Use discard sparingly to avoid confusing senders,
  • Use reject for clear policy violations,
  • Use tempfail for transient issues,
  • Use custom for uncertain cases.

Sources for custom codes