CLEANUP(8postfix)
π CLEANUP(8postfix) π
okay bestie, you clicked on the cleanup(8) page and honestly? taste. this is the manual for the Postfix daemon that gives your inbound mail its little glow-up before it hits the queue. let's get into it, no gatekeeping. π¦
π NAME π
cleanup β canonicalize and enqueue Postfix message
β¨ SYNOPSIS β¨
cleanup [generic Postfix daemon options]
π DESCRIPTION π
so the cleanup(8) daemon is the one that catches inbound mail, slides it into the incoming mail queue, and then tells the queue manager "bestie it's here" like the reliable main character it is. π
here's the full list of transformations it does, and yes we're listing all of them:
- Insert missing message headers:
(Resent-)From:,To:,Message-Id:, andDate:. This is enabled with thelocal_header_rewrite_clientsandalways_add_missing_headersparameter settings. - Transform envelope and header addresses to the standard
user@fully-qualified-domainform that is expected by other Postfix programs. This task depends on thetrivial-rewrite(8)daemon. The header transformation is enabled with thelocal_header_rewrite_clientsparameter setting. - Eliminate duplicate envelope recipient addresses. This is enabled with the
duplicate_filter_limitparameter setting. - Remove message headers:
Bcc,Content-Length,Resent-Bcc,Return-Path. This is enabled with themessage_drop_headersparameter setting. - Optionally, rewrite all envelope and header addresses according to the mappings specified in the
canonical(5)lookup tables. The header transformation is enabled with thelocal_header_rewrite_clientsparameter setting. - Optionally, masquerade envelope sender addresses and message header addresses (i.e. strip host or domain information below all domains listed in the
masquerade_domainsparameter, except for user names listed inmasquerade_exceptions). By default, address masquerading does not affect envelope recipients. The header transformation is enabled with thelocal_header_rewrite_clientsparameter setting. - Optionally, expand envelope recipients according to information found in the
virtual_alias_mapslookup tables.
and then it does a whole vibe check on the content of every single message. when it spots a problem, by default it hands a diagnostic status back to the cleanup service client and lets that client deal with the mess. but alternatively, the client can ask the cleanup(8) daemon to bounce the message back to the sender when things go sideways. π
π STANDARDS π
- RFC 822 (ARPA Internet Text Messages)
- RFC 2045 (MIME: Format of Internet Message Bodies)
- RFC 2046 (MIME: Media Types)
- RFC 2822 (Internet Message Format)
- RFC 3463 (Enhanced Status Codes)
- RFC 3464 (Delivery status notifications)
- RFC 5322 (Internet Message Format)
π©Ί DIAGNOSTICS π©Ί
Problems and transactions are logged to syslogd(8) or postlogd(8).
π BUGS π
Table-driven rewriting rules make it hard to express if then else and other logical relationships. (not me defending it, that's just what the page says π
)
βοΈ CONFIGURATION PARAMETERS βοΈ
changes to main.cf are picked up automatically, because cleanup(8) processes run for only a limited amount of time. and if you want that change to hit faster, run the command postfix reload. β¨
the text below is only a parameter summary, bestie. see postconf(5) for more details including examples.
π COMPATIBILITY CONTROLS π
undisclosed_recipients_header(see 'postconf -d' output) β Message header that the Postfixcleanup(8)server inserts when a message contains noTo:orCc:message header.
Available in Postfix version 2.1 only:
enable_errors_to(no) β Report mail delivery errors to the address specified with the non-standardErrors-To:message header, instead of the envelope sender address (this feature is removed with Postfix version 2.2, is turned off by default with Postfix version 2.1, and is always turned on with older Postfix versions).
Available in Postfix version 2.6 and later:
always_add_missing_headers(no) β Always add(Resent-)From:,To:,Date:orMessage-ID:headers when not present.
Available in Postfix version 2.9 and later:
enable_long_queue_ids(no) β Enable long, non-repeating, queue IDs (queue file names).
Available in Postfix version 3.0 and later:
message_drop_headers(bcc, content-length, resent-bcc, return-path) β Names of message headers that thecleanup(8)daemon will remove after applyingheader_checks(5)and before invoking Milter applications.header_from_format(standard) β The format of the Postfix-generatedFrom:header.
π§Ό BUILT-IN CONTENT FILTERING CONTROLS π§Ό
Postfix built-in content filtering is meant to stop a flood of worms or viruses. It is not a general content filter. read that again, bestie, it's giving "purpose-built, not a catch-all". π
body_checks(empty) β Optional lookup tables for content inspection as specified in thebody_checks(5)manual page.header_checks(empty) β Optional lookup tables for content inspection of primary non-MIME message headers, as specified in theheader_checks(5)manual page.
Available in Postfix version 2.0 and later:
body_checks_size_limit(51200) β How much text in a message body segment (or attachment, if you prefer to use that term) is subjected tobody_checksinspection.mime_header_checks($header_checks) β Optional lookup tables for content inspection of MIME related message headers, as described in theheader_checks(5)manual page.nested_header_checks($header_checks) β Optional lookup tables for content inspection of non-MIME message headers in attached messages, as described in theheader_checks(5)manual page.
Available in Postfix version 2.3 and later:
message_reject_characters(empty) β The set of characters that Postfix will reject in message content.message_strip_characters(empty) β The set of characters that Postfix will remove from message content.
Available in Postfix version 3.9, 3.8.5, 3.7.10, 3.6.14, 3.5.24, and later:
cleanup_replace_stray_cr_lf(yes) β Replace each stray<CR>or<LF>character in message content with a space character, to prevent outbound SMTP smuggling, and to make the evaluation of Postfix-added DKIM or other signatures independent from how a remote mail server handles such characters. (protective queen behavior, honestly π«Ά)
π‘οΈ BEFORE QUEUE MILTER CONTROLS π‘οΈ
As of version 2.3, Postfix supports the Sendmail version 8 Milter (mail filter) protocol. When mail is not received via the smtpd(8) server, the cleanup(8) server will simulate SMTP events to the extent that this is possible. For details see the MILTER_README document.
non_smtpd_milters(empty) β A list of Milter (mail filter) applications for new mail that does not arrive via the Postfixsmtpd(8)server.milter_protocol(6) β The mail filter protocol version and optional protocol extensions for communication with a Milter application; prior to Postfix 2.6 the default protocol is2.milter_default_action(tempfail) β The default action when a Milter (mail filter) response is unavailable (for example, bad Postfix configuration or Milter failure).milter_macro_daemon_name($myhostname) β The{daemon_name}macro value for Milter (mail filter) applications.milter_macro_v($mail_name $mail_version) β The{v}macro value for Milter (mail filter) applications.milter_connect_timeout(30s) β The time limit for connecting to a Milter (mail filter) application, and for negotiating protocol options.milter_command_timeout(30s) β The time limit for sending an SMTP command to a Milter (mail filter) application, and for receiving the response.milter_content_timeout(300s) β The time limit for sending message content to a Milter (mail filter) application, and for receiving the response.milter_connect_macros(see 'postconf -d' output) β The macros that are sent to Milter (mail filter) applications after completion of an SMTP connection.milter_helo_macros(see 'postconf -d' output) β The macros that are sent to Milter (mail filter) applications after the SMTPHELOorEHLOcommand.milter_mail_macros(see 'postconf -d' output) β The macros that are sent to Milter (mail filter) applications after the SMTPMAIL FROMcommand.milter_rcpt_macros(see 'postconf -d' output) β The macros that are sent to Milter (mail filter) applications after the SMTPRCPT TOcommand.milter_data_macros(see 'postconf -d' output) β The macros that are sent to version 4 or higher Milter (mail filter) applications after the SMTPDATAcommand.milter_unknown_command_macros(see 'postconf -d' output) β The macros that are sent to version 3 or higher Milter (mail filter) applications after an unknown SMTP command.milter_end_of_data_macros(see 'postconf -d' output) β The macros that are sent to Milter (mail filter) applications after the message end-of-data.
Available in Postfix version 2.5 and later:
milter_end_of_header_macros(see 'postconf -d' output) β The macros that are sent to Milter (mail filter) applications after the end of the message header.
Available in Postfix version 2.7 and later:
milter_header_checks(empty) β Optional lookup tables for content inspection of message headers that are produced by Milter applications.
Available in Postfix version 3.1 and later:
milter_macro_defaults(empty) β Optional list ofname=valuepairs that specify default values for arbitrary macros that Postfix may send to Milter applications.
πΈ MIME PROCESSING CONTROLS πΈ
Bestie, this whole lil cluster is available in Postfix version 2.0 and later:
disable_mime_input_processing(no) β flips OFF MIME processing while mail is being received. yeah. it just... stops reading the MIME structure. that's the whole thing.mime_boundary_length_limit(2048) β the maximal length of MIME multipart boundary strings. boundaries longer than this? not the vibe.mime_nesting_limit(100) β how deep the MIME processor is willing to recurse. it's giving "I will go this far and no further."strict_8bitmime(no) β turns on bothstrict_7bit_headersandstrict_8bitmime_bodyat once. two for one, slay.strict_7bit_headers(no) β rejects mail with 8-bit text sitting in message headers. nope, not in my headers.strict_8bitmime_body(no) β rejects 8-bit message body text that has no 8-bit MIME content encoding info attached. rude of it to show up undocumented, honestly.strict_mime_encoding_domain(no) β rejects mail with invalidContent-Transfer-Encoding:info for themessage/*ormultipart/*MIME content types. invalid encoding domain? blocked. π«
Available in Postfix version 2.5 and later:
detect_8bit_encoding_header(yes) β automatically detects 8BITMIME body content by peeking atContent-Transfer-Encoding:message headers. fun fact: historically this behavior was hard-coded to be "always on", so now you get a lil switch. π
π AUTOMATIC BCC RECIPIENT CONTROLS π
Postfix can auto-add BCC (blind carbon copy) when mail enters the mail system. sneaky. iconic. very "you didn't see anything" energy:
always_bcc(empty) β an optional address that receives a "blind carbon copy" of each and every message received by the Postfix mail system. every single one. bestie is watching. π
Available in Postfix version 2.1 and later:
sender_bcc_maps(empty) β optional BCC (blind carbon-copy) address lookup tables, indexed by sender address.recipient_bcc_maps(empty) β optional BCC (blind carbon-copy) address lookup tables, indexed by recipient address.
π¦ ADDRESS TRANSFORMATION CONTROLS π¦
Okay so the actual address rewriting gets delegated to the trivial-rewrite(8) daemon β cleanup is not doing that labor. but the cleanup(8) server <em>does</em> implement table driven address mapping. teamwork makes the dream work.
empty_address_recipient(MAILER-DAEMON) β who receives mail addressed to the null address. the void's forwarding address, lowkey.canonical_maps(empty) β optional address mapping lookup tables for message headers and envelopes.recipient_canonical_maps(empty) β optional address mapping lookup tables for envelope and header recipient addresses.sender_canonical_maps(empty) β optional address mapping lookup tables for envelope and header sender addresses.masquerade_classes(envelope_sender, header_sender, header_recipient) β what addresses are subject to address masquerading. dress-up but for addresses. πmasquerade_domains(empty) β optional list of domains whose subdomain structure gets stripped off in email addresses.masquerade_exceptions(empty) β optional list of user names that are not subjected to address masquerading, even when their addresses match$masquerade_domains. the chosen few who don't have to play dress-up.propagate_unmatched_extensions(canonical, virtual) β what address lookup tables copy an address extension from the lookup key over to the lookup result.
Available before Postfix version 2.0:
virtual_maps(empty) β optional lookup tables with a) names of domains for which all addresses are aliased to addresses in other local or remote domains, and b) addresses that are aliased to addresses in other local or remote domains. two jobs, one parameter, very multitasking of it.
Available in Postfix version 2.0 and later:
virtual_alias_maps($virtual_maps) β optional lookup tables that alias specific mail addresses or domains to other local or remote address. note it defaults to whatever$virtual_mapsis, so the old one lives on through this one. legacy but make it cute.
Available in Postfix version 2.2 and later:
canonical_classes(envelope_sender, envelope_recipient, header_sender, header_recipient) β what addresses are subject tocanonical_mapsaddress mapping.recipient_canonical_classes(envelope_recipient, header_recipient) β what addresses are subject torecipient_canonical_mapsaddress mapping.sender_canonical_classes(envelope_sender, header_sender) β what addresses are subject tosender_canonical_mapsaddress mapping.remote_header_rewrite_domain(empty) β when this parameter is empty, message headers from remote clients get no rewriting at all; otherwise message headers get rewritten and the specified domain name gets appended to incomplete addresses. blank means leave it alone, periodt.
π₯ RESOURCE AND RATE CONTROLS π₯
duplicate_filter_limit(1000) β the maximal number of addresses the address duplicate filter remembers, foraliases(5)orvirtual(5)alias expansion, or forshowq(8)queue displays. memory is precious bestie.header_size_limit(102400) β the maximal amount of memory, in bytes, for storing a message header. that's the budget. don't blow it.hopcount_limit(50) β the maximal number ofReceived:message headers allowed in the primary message headers. after that it's giving "this message has been around the block."in_flow_delay(1s) β how long to pause before accepting a new message, when the message arrival rate exceeds the message delivery rate. yes, it's a lil breather. inhale. exhale. π§message_size_limit(10240000) β the maximal size in bytes of a message, including envelope information. envelope counts, no cheating.
Available in Postfix version 2.0 and later:
header_address_token_limit(10240) β the maximal number of address tokens allowed in an address message header.mime_boundary_length_limit(2048) β the maximal length of MIME multipart boundary strings. (yes it shows up twice in this page, and yes we're listing it twice, because facts are facts π )mime_nesting_limit(100) β the maximal recursion level that the MIME processor will handle. (also a rerun. still true. still listed.)queue_file_attribute_count_limit(100) β the maximal number of(name=value)attributes that may be stored in a Postfix queue file.
Available in Postfix version 2.1 and later:
virtual_alias_expansion_limit(1000) β the maximal number of addresses that virtual alias expansion produces from each original recipient.virtual_alias_recursion_limit(1000) β the maximal nesting depth of virtual alias expansion. stop going deeper, bestie.
Available in Postfix version 3.0 and later:
virtual_alias_address_length_limit(1000) β the maximal length of an email address after virtual alias expansion. expansion does NOT mean infinite glow-up.
π SMTPUTF8 CONTROLS π
Preliminary SMTPUTF8 support is introduced with Postfix 3.0. preliminary!! we're early adopters.
smtputf8_enable(yes) β enables preliminary SMTPUTF8 support for the protocols described in RFC 6531..6533.smtputf8_autodetect_classes(sendmail, verify) β detects that a message requires SMTPUTF8 support for the specified mail origin classes.
Available in Postfix version 3.2 and later:
enable_idna2003_compatibility(no) β enables 'transitional' compatibility between IDNA2003 and IDNA2008, when converting UTF-8 domain names to/from the ASCII form used for DNS lookups.
β¨ MISCELLANEOUS CONTROLS β¨
config_directory(seepostconf -doutput) β the default location of the Postfixmain.cfandmaster.cfconfiguration files.daemon_timeout(18000s) β how much time a Postfix daemon process may take to handle a request before a built-in watchdog timer terminates it. clock's ticking. β°delay_logging_resolution_limit(2) β the maximal number of digits after the decimal point when logging sub-second delay values.delay_warning_time(0h) β the time after which the sender receives a copy of the message headers of mail that is still queued.ipc_timeout(3600s) β the time limit for sending or receiving information over an internal communication channel.max_idle(100s) β the maximum amount of time an idle Postfix daemon process waits for an incoming connection before terminating voluntarily. it's not ghosting you, it's scheduled.max_use(100) β the maximal number of incoming connections a Postfix daemon process will service before terminating voluntarily.myhostname(seepostconf -doutput) β the internet hostname of this mail system. your name tag. π·οΈmyorigin($myhostname) β the domain name that locally-posted mail appears to come from, and that locally posted mail is delivered to.process_id(read-only) β the process ID of a Postfix command or daemon process.process_name(read-only) β the process name of a Postfix command or daemon process.queue_directory(seepostconf -doutput) β the location of the Postfix top-level queue directory.soft_bounce(no) β safety net to keep mail queued that would otherwise be returned to the sender. it's the "wait, let's not do anything drastic" switch.syslog_facility(mail) β the syslog facility of Postfix logging.syslog_name(seepostconf -doutput) β a prefix prepended to the process name in syslog records, so that, for example,"smtpd"becomes"prefix/smtpd".
Available in Postfix version 2.1 and later:
enable_original_recipient(yes) β enables support for the original recipient address after an address is rewritten to a different address (for example with aliasing or with canonical mapping). keeps the receipts of who it originally was. π§Ύ
Available in Postfix 3.3 and later:
service_name(read-only) β themaster.cfservice name of a Postfix daemon process.
Available in Postfix 3.5 and later:
info_log_address_format(external) β the email address form used in non-debug logging (info, warning, etc.).
π FILES π
/etc/postfix/canonical*β canonical mapping table/etc/postfix/virtual*β virtual mapping table
π«Ά SEE ALSO π«Ά
trivial-rewrite(8), address rewritingqmgr(8), queue managerheader_checks(5), message header content inspectionbody_checks(5), body parts content inspectioncanonical(5), canonical address lookup table formatvirtual(5), virtual alias lookup table formatpostconf(5), configuration parametersmaster(5), generic daemon optionsmaster(8), process managerpostlogd(8), Postfix loggingsyslogd(8), system logging
π§ README FILES π§
Use "postconf readme_directory" or "postconf html_directory" to locate this information.
ADDRESS_REWRITING_READMEβ Postfix address manipulationCONTENT_INSPECTION_READMEβ content inspection
π LICENSE π
The Secure Mailer license must be distributed with this software. (yes, actually. distribute it. it's the rules, bestie.)
π AUTHOR(S) π
Wietse Venema IBM T.J. Watson Research P.O. Box 704 Yorktown Heights, NY 10598, USA
Wietse Venema Google, Inc. 111 8th Avenue New York, NY 10011, USA
and that's the whole page, bestie π this was CLEANUP(8postfix) β go forth and clean up some mail, you absolute icon β¨ππ¦
π¦ where this page comes from
- debian bookworm: postfix 3.7.11-0+deb12u1
- ubuntu noble: postfix 3.8.6-1build2
- ubuntu noble: postfix 3.8.6-1ubuntu0.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms