procmail
TLDR
Deliver mail using recipes
$ procmail < [email.txt]
Test recipe file$ procmail -m [VERBOSE=on] [recipe] < [email.txt]
Specify maildir$ procmail -d [maildir]
SYNOPSIS
procmail [options] [parameters] [recipes...]
DESCRIPTION
procmail is a mail delivery agent and filtering program. It sorts incoming mail into folders based on rules defined in .procmailrc, enabling automatic mail organization.
The tool can filter spam, sort mailing lists, forward mail, and execute scripts based on message content.
PARAMETERS
-d maildir
Delivery directory.-m [params]
Use as filter.-t
Fail if not run as daemon.-v
Verbose mode.-f fromline
Set From line.
RECIPE FORMAT
$ :0 [flags] [:lockfile]
* condition
action
Flags: H=header, B=body, h=header to pipe, b=body to pipe* condition
action
CAVEATS
Complex recipe syntax. Security requires careful configuration. Largely superseded by server-side filters. Maintenance can be tricky.
HISTORY
procmail was written by Stephen van den Berg starting in 1990. It became the standard Unix mail filtering tool, though its usage has declined with webmail and server-side filtering. It's still used for advanced local mail processing.


