FILTER(1)

๐Ÿ’– FILTER(1) โ€” the girlies' guide to filtering ur mail ๐Ÿ’–

okay bestie, so this is a page from the General Commands Manual, and it's about a lil program called filter. sit down, hydrate, we're doing this ๐Ÿซถ

โœจ NAME โœจ

filter โ€” filter incoming messages before adding to mailbox

like, it's the bouncer at the door of ur inbox. it checks the vibes of every message before letting it in ๐Ÿ’…


โœจ SYNOPSIS โœจ

filter [-q] [-v] [-l] [-o output] [-f rules-file] [-m mailbox]
filter [-n] [-f rules-file]
filter [-r] [-o output] [-f rules-file]
filter [-c] [-s] [-o output] [-f rules-file]
filter [-c] [-S] [-o output] [-f rules-file]

five whole moods, pick ur fighter โœจ


โœจ DESCRIPTION โœจ

so the tl;dr โ€” filter is literally designed to sort ur incoming mail based on user preferences for various recognized headers. it logs a summary of messages filtered to a logfile. that's the vibe check. ๐Ÿ“ฌ

for the full tea, scroll down to the USAGE section, because there's a LOT there and it's honestly iconic.


โœจ OPTIONS โœจ

these are the flags filter understands, no cap:

  • -c โ€” Clear logs. if u use this flag, the log files get removed after being summarized by either -s or -S (peep below). so like, summarize first, THEN yeet ๐Ÿ—‘๏ธ
  • -f rules-file โ€” get ur rules from the specified file instead of the default $HOME/.filter/filter-rules. custom rules, custom vibes ๐Ÿ’…
  • -l โ€” Log actions only. do NOT log info about mailed messages. we're keeping it minimal bestie
  • -n โ€” Not really. output what would happen if given a message from standard input, but don't actually do anything with it. it's giving window shopping ๐Ÿ›๏ธ
  • -o file โ€” redirect stdout messages to the specified file or device. logging of filter actions is not affected. (this was added to more gracefully deal with changes in the file system, since sendmail is quite picky about modes of files being redirected into.) picky king ๐Ÿ™„
  • -m mailbox โ€” override the compiled in definition of ur primary mailbox. this is disabled if filter is setgid. sorry bestie, security said no
  • -q โ€” Quiet. do not log filtering actions. shhhh ๐Ÿคซ
  • -r โ€” Rules. list the rules currently being used. receipts, basically ๐Ÿงพ
  • -s โ€” Summarize. list a summary of the message filtering log
  • -S โ€” same as -s but ALSO includes message-by-message information. extra detail, extra slay โœจ
  • -v โ€” Verbose. give output on standard out for each message filtered. may be useful to set output to /dev/console or other logging device. (see -o). she's chatty and we love her ๐Ÿ—ฃ๏ธ

โœจ USAGE โœจ

okay this is the main character section, lock in ๐Ÿ”ฅ

filter uses a set of selection rules to process incoming mail messages. these rules are normally read in from $HOME/.filter/filter-rules. as soon as a rule matches something about the message, that rule is used, and no further action is taken โ€” first match wins, periodt. the general format for a rule is:

if  (expression)  then  action

where expression is:

expression  ::=  { not }  condition  { and expression }

condition  ::=  field  =  stringvalue
           ::=  field  != stringvalue
           ::=  lines  relop  numvalue
or                 ::=  always

these further break down as:

field  ::=  from  |  subject  |  alphasubject  |  to  |  lines | sender

relop  ::=  =  |  !=  |  <  |  >  |  <=  |  >=

stringvalue  ::=  any  quoted  string

numvalue  ::=  any  integer  value
note: alphasubject is a transformed version of the subject line, where only alpha chars are preserved, and they are forced to lower case. it is then simpler to use a regular expression match across a wide variety of similar subjects. she's a glow-up of the subject line fr fr โœจ

from matches any and all of the following headers:

"From " From: Reply-To: Sender:

so from is not just one thing, it's a whole friend group ๐Ÿ‘‘

Action can be any of:

delete              (ignore this message; throw it away)
save  foldername    (put in 'foldername' for later)
savecopy foldername (save a copy AND put in my inbox)
execute  command    (pipe message to 'command')
executec command    (copy to inbox, AND pipe to 'command')
forward  address    (forward this message)
forwardc address    (forward this message, AND copy to inbox)
resend   address    (resend to new addr without change)
leave               (just put it in my inbox)
bounce              (say there's no such user)

an example of a rules file would be:

# I'll read this stuff later when I feel like it
if (from = "list@interest.org") then save "~/Mail/mailinglist"
# This mailing list actually has an x-mailing-list header
if (mailinglist = "smartlist@other.com") then save "~/Mail/otherlist"
# auto-archive this project's email, AND put in my current mailbox
if (subject = "strange project") then savecopy "~/Mail/proj-archive"
# If "make money" appears ANYWHERE in subject, upper/lowercase,
# delete the lousy spam
if ( subject = "make money" ) then delete
# This person no longer shares this virtual mailbox with me.
# Resend visibly as a "forwarded" message.
if (to = "partner") then forward "partner@new.address.com"
# If email for an old address comes to me, resend to new one.
# Note that the "envelope" will show my address, but the
# normal headers will not
if ( to = "old_address" ) then resend new@address.here"
# Special virtual headerline derived from normal subject line
# catches "multiple!!!wor+ds**here"
if ( alphasubject = "multiplewordshere" ) then delete
# If email for a special address comes to me, resend through
# a non-standard "special" mailer
if ( to = "special_address" ) then exec "/usr/lib/mailer special@addr"
#
# The rules file doesn't really need parentheses. Or even the 'if'.
# They are just traditional.
subject = "silly" then bounce
note that all filenames must be double-quoted โ€” yes, all of them, no exceptions bestie ๐Ÿ’…

for further information about the rules language, please see The Elm Filter Guide.


โœจ MAINTAINER โœจ

Philip Brown ๐Ÿ‘‘


โœจ FILES โœจ

  • $HOME/.filter/filter-rules โ€” default rules file ๐Ÿ“
  • $HOME/.filter/filterlog โ€” a log of what has been done
  • $HOME/.filter/filtersum โ€” a summary of what has been done
  • $MAIL โ€” if you set this var, defines ur default mailbox ๐Ÿ“ฎ
  • /etc/passwd โ€” used to get users home directory

โœจ SEE ALSO โœจ

  • The Elm Filter Guide (distributed with the source code) ๐Ÿ“–
  • mail(1), mailx(1), sendmail(1,8)

โœจ COMMENTS โœจ

ngl it could be smarter about pattern matching ๐Ÿ˜ญ message body checks might be nice too. we're manifesting it bestie ๐Ÿ•ฏ๏ธ

please note that this was historically bundled with the elm mail reader, but now can be found at http://www.bolthole.com/filter/ โ€” glow up era ๐ŸŒˆ


โœจ BUG REPORTS TO โœจ

filter@bolthole.com โ€” tell them everything, they wanna know ๐Ÿ’Œ


โœจ COPYRIGHTS โœจ

Copyright 1988-1992 by The USENET Community Trust
Derived from Elm 2.0,  Copyright 1986, 1987 by Dave Taylor

and that's the whole page, bestie ๐ŸŽ€ USENET Comm. Trust, 19 April 2004, page FILTER(1) โ€” mwah, go filter ur mail, u got this ๐Ÿ’–๐Ÿฆ‹โœจ

๐Ÿ“ฆ where this page comes from