procmail
[Top] [All Lists]

Re: Forward mail

1997-07-04 05:29:00
On Fri, 4 Jul 1997 13:21:43 +0200, "Raymond Willemsen" 
<rambox(_at_)tin(_dot_)it>
wrote:
Is there a way if an email message is coming in without subject
and body forward it with subject and body using Procmail?

What do you mean? What should be in the body of the forwarded message?
(Or do you mean without a subject but with a body?) How would you
generate the Subject line?

This probably can't take you very far but it might be useful as pseudo
code:

    :0fhw
    * ! ^Subject:
    * B ?? < 2
    | formail -A"Subject: Automatically generated Subject"; \
      echo "Automatically generated body"

    ... processing continues here

If you don't want processing to continue, remove the f flag and add a
delivering action (and possibly a lock) to the recipe: 

    :0h:
    * ! ^Subject:
    * B ?? < 2
    | formail -A"Subject: Automatically generated Subject"; \
      echo "Automatically generated body" >>IN.oddity

Of course, if the delivering action is to forward it to a second
account somewhere, you don't need a lock. 

The VAR ?? < n syntax was broken in some earlier releases of Procmail.
  The present condition allows at most two bytes of message body (a
few spurious newlines perhaps) but you might want to increase that
slightly -- I believe some MTAs or MDAs will actually add a few
newlines to all messages.

If you want to check for a body which consists merely of whitespace,
any amount of it, you can replace the second condition with

    * B ?? ^^([         ]*$)*^^

The stuff inside the brackets are a space and a tab. This is the usual
way to allow for any amount of horizontal whitespace.

Hope this helps; if not, perhaps you can submit a more detailed
description of what you wish to accomplish? 

/* era */

-- 
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r.  <http://www.iki.fi/~era/>
 * Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>

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