procmail
[Top] [All Lists]

Re: Forwarding til mobile-phone

1999-05-14 03:17:28
On Fri, 14 May 1999 00:58:33 +0200,
Rene Joergensen <fox(_at_)nowhere(_dot_)dk> wrote:
:0 c
* !^TOpostmaster
* !^TOcisco
   | echo 'You have mail' ;formail -X FROM: \
     -X Subject: | $SENDMAIL XXXXXXXX(_at_)gsm1800(_dot_)telia(_dot_)dk

Paraphrase of the action line:

    Feed the input message to echo (who politely ignores it) ;
    Send an empty message to XXXXXXXX(_at_)gsm1800

(Hint: If you think of this in terms of precedence, you could say that
";" is stronger than "|" -- the output of formail, but not of echo, is
part of the pipeline to sendmail. You can fix this with parentheses,
just like you need to change 1+2*3 to (1+2)*3 if you want the result
to be 9.)

But just adding the parentheses still won't work, because 'You have
mail' is not a valid email header and so Sendmail will probably do
something undesirable to the message.

To see what you are doing, you can run your pipeline from the command
line and examine the output you are producing. Here's a test with a
small bogus message I type in directly on the command line, where I
have fixed the precedence problem, but left out the Sendmail part
(because we want to see the results on standard output for now, while
testing):

 $ ( echo 'You have mail' ; formail -X FROM: -X Subject: ) <<HERE
From: me
To: you
Subject: Test message
X-Random-Header: This will be discarded anyhow

Here is the body of the message. How are you?
HERE
 You have mail
 From: me
 Subject: Test message

What you would probably like to be passing to Sendmail is more like
what you'd get with

  ( formail -XSubject: -XFrom: ; echo ; echo 'You have mail' )

... but it's not entirely clear why you'd want the message to have a
body at all, since the fact that you have mail should be fairly
obvious by the time you get this message, if you know what I mean. :-)

:0
/var/spool/mail/fox

You should use locking when writing to a file, but if this is the last
recipe in your .procmailrc, it's really superfluous (if your $DEFAULT
expands to /var/spool/mail/fox -- you could set DEFAULT to point here
if not, to accomplish the same result).

Hope this helps,

/* era */

-- 
.obBotBait: It shouldn't even matter whether     <http://www.iki.fi/era/>
I am a resident of the state of Washington. <http://members.xoom.com/procmail/>
 * Sign the European spam petition! <http://www.politik-digital.de/spam/en/> *

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