procmail
[Top] [All Lists]

Re: Formail with or without Sendmail

2000-01-25 18:22:54
There's no overlap in functionality between formail and sendmail
(and procmail, for that matter). They are building blocks that can
be used together.

Sendmail (either the specific MTA of that name, or the "sendmail"
interface provided by all other MTAs for compatibility) takes an
email message on stdin, and delivers it somewhere. That's all it
ever does. It's complicated by internet routing, .forward file
processing, aliases, etc., but all the same, you pipe a message into
sendmail and it goes somewhere. That's it.

Procmail reads a message on stdin and decides what to do with it,
based on a list of rules specified in a procmailrc file. It can do
just a few possible things: it can deliver it into a mailbox, or it
can pipe it into a program. Optionally it can read what pops back
out of that program and treat it as the message "revised", and
continue processing. Procmail can forward messages to other
addresses, but that's just a typographic shorthand for piping the
message into sendmail to deliver it.

Formail is a helper program that can do a bunch of transformations
on messages. It can edit the headers in many interesting ways. It
can maintain databases designed to be helpful for eliminating
duplicates in various settings. It can parse mbox-format mail
folders, splitting up the messages; it can read RFC-822-compatible
messages and add the "From " header needed to turn them into
mbox-format folders. Some invocations of formail end up calling
sendmail. E.g. the formail invocation

        formail -s pgm

splits an mbox into messages, and pipes each of them through "pgm".
So

        formail -s sendmail -t

will re-submit every message for re-delivery. And

        formail -s sendmail a(_dot_)friend(_at_)his(_dot_)email(_dot_)server

will forward all the messages to a friend.

Hard to picture sendmail using formail for anything, that just
doesn't happen.

Other uses of formail don't use sendmail. A common one is in a
procmail recipe pattern:

        :0 c
        * !^X-Loop: your(_at_)email(_dot_)addr
        | formail -A"X-Loop: your(_at_)email(_dot_)addr"|$SENDMAIL 
some(_at_)where(_dot_)else

That does trivial forwarding with loop prevention. In this
application formail is being used to add a header, after checking
that the header isn't already present. A message can't loop through
this recipe twice. You'll see that pattern --- check to make sure
X-Loop isn't present, then add it --- in a _lot_ of procmail
recipes.

Hope something here helps.

-Bennett

Attachment: pgpFXd0RTXSH3.pgp
Description: PGP signature

<Prev in Thread] Current Thread [Next in Thread>