EnglishFrenchSpanish

OnWorks favicon

filter - Online in the Cloud

Run filter in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command filter that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

PROGRAM:

NAME


filter - filter incoming messages before adding to mailbox

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]

DESCRIPTION


In brief, filter is designed to sort incoming mail based on user preferences for various
recognized headers. It logs a summary of messages filtered to a logfile. See the USAGE
section for full details.

OPTIONS


The flags the filter program understands are;

-c Clear logs. If this flag is used, the log files will be removed after being
summarized by either "-s" or "-S" (see below).

-f rules-file
Get rules from specified file instead of default $HOME/.filter/filter-rules

-l Log actions only. Do not log information about mailed messages.

-n Not really. Output what would happen if given message from standard input, but
don't actually do anything with it.

-o file Redirect stdout messages to the specified file or device. Logging of filter
actions is not affected. (This is added to more gracefully deal with changes in
the file system (since sendmail is quite picky about modes of files being
redirected into.))

-m mailbox
Override the compiled in definition of your primary 'mailbox'. This is disabled
if filter is setgid.

-q Quiet. Do not log filtering actions.

-r Rules. List the rules currently being used.

-s Summarize. List a summary of the message filtering log.

-S This is the same as `-s' but includes message-by-message information
additionally.

-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).

USAGE


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. 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.

from matches any and all of the following headers:
"From " From: Reply-To: Sender:

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 = "[email protected]") then save "~/Mail/mailinglist"
# This mailing list actually has an x-mailing-list header
if (mailinglist = "[email protected]") 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 "[email protected]"
# 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 [email protected]"
# 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

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

MAINTAINER


Philip Brown

Use filter online using onworks.net services


Free Servers & Workstations

Download Windows & Linux apps

  • 1
    Alt-F
    Alt-F
    Alt-F provides a free and open source
    alternative firmware for the DLINK
    DNS-320/320L/321/323/325/327L and
    DNR-322L. Alt-F has Samba and NFS;
    supports ext2/3/4...
    Download Alt-F
  • 2
    usm
    usm
    Usm is a unified slackware package
    manager that handles automatic
    dependency resolution. It unifies
    various package repositories including
    slackware, slacky, p...
    Download usm
  • 3
    Chart.js
    Chart.js
    Chart.js is a Javascript library that
    allows designers and developers to draw
    all kinds of charts using the HTML5
    canvas element. Chart js offers a great
    array ...
    Download Chart.js
  • 4
    iReport-Designer for JasperReports
    iReport-Designer for JasperReports
    NOTE: iReport/Jaspersoft Studio Support
    Announcement: As of version 5.5.0,
    Jaspersoft Studio will be the official
    design client for JasperReports. iReport
    will...
    Download iReport-Designer for JasperReports
  • 5
    PostInstallerF
    PostInstallerF
    PostInstallerF will install all the
    software that Fedora Linux and others
    doesn't include by default, after
    running Fedora for the first time. Its
    easy for...
    Download PostInstallerF
  • 6
    strace
    strace
    The strace project has been moved to
    https://strace.io. strace is a
    diagnostic, debugging and instructional
    userspace tracer for Linux. It is used
    to monitor a...
    Download strace
  • More »

Linux commands

Ad