Documentation

NAME

mimedefang-test-mail -- run mimedefang-filter against a single .eml file

SYNOPSIS

mimedefang-test-mail [options] message.eml

OPTIONS

  • -f, --filter FILE

    Path to the mimedefang-filter file to load (default: /etc/mail/mimedefang-filter).

  • --from ADDR

    Envelope sender address. Defaults to the address derived from the message's own Authentication-Results/Sender headers if present, else the address parsed out of the message's From: header.

  • --to ADDR

    Envelope recipient address. May be repeated for multiple recipients. Defaults to the address parsed out of the message's To: header.

  • --relay-ip IP

    Simulated connecting relay IP address. Defaults to the address derived from the message's own X-Relay-Addr/Authentication-Results headers if present, else 127.0.0.1.

  • --relay-host NAME

    Simulated connecting relay hostname. Defaults to the hostname derived from the message's own Authentication-Results header if present, else localhost.

  • --helo NAME

    Simulated SMTP HELO/EHLO argument. Defaults to the HELO derived from the message's own Received:/Authentication-Results headers if present, else the same as --relay-host.

  • --macro NAME=VALUE

    Simulate a Sendmail/Postfix milter macro, e.g. --macro auth_authen=someuser or --macro tls_version=TLSv1.3. May be repeated for multiple macros. Populates %Mail::MIMEDefang::SendmailMacros for all filter phases.

    auth_authen, tls_version, cipher and cipher_bits are auto-derived from the message's own top Received: (and Authentication-Results) header when not passed explicitly via --macro. _ is likewise auto-derived from the reverse PTR record of --relay-ip (falling back to [IP] when there's no PTR) unless overridden.

  • --keep-workdir

    Do not delete the temporary work directory afterwards; print its path so Work/, COMMANDS and RESULTS can be inspected.

  • -o, --output FILE

    Write the resulting message -- the original message with any header and body changes made by the filter applied -- to FILE.

DESCRIPTION

This tool drives the real mimedefang-filter callbacks (filter_relay, filter_helo, filter_sender, filter_recipient, filter_begin, filter, filter_end) in-process against a single .eml file, the same way mimedefang.pl itself does in its one-shot mode -- without needing a running MTA, milter socket, or multiplexor.

It never relays or delivers mail: any sender/administrator notifications the filter would have sent are printed to stderr instead of being handed to a real sendmail binary.