.forward/elm filter/time question

.forward/elm filter/time question

Post by Jon Hughes and Alice Pinar » Thu, 16 Oct 1997 04:00:00



My boyfriend and I share an email box but when he's at work he can only
reach his work box. I set up a .forward and some rules with elm filter to
send him anything that didn't come from himself or my relatives (and
others who will be mostly talking just to me)  Works, kewl.. pat on
back... My boyfriend then sends me email saying 'ok that's good but can
you set it up to only work between 8am and 5pm.

Hmmm.. I _could_ try and learn procmail... but don't feel like it.  I
_could_ try to play with cron jobs... but since I'm not an admin at my ISP
I'd rather not deal with stuff I have to ask someone else to give me more
permissions for.

So far I see two places where there is the possibility this could work.
I've done a little shell scripting but I'm not exactly sure how sendmail
deals with .forward

Idea 1. says I take my present .forward
"|/usr/local/bin/filter -f /home3/ccdsf/.aegonrules"
and put some function in so that when the hour is greater than 8 and less
than 17 .aegonrules is used and during other times another rules file is
used that just leaves mail in our shared box without forwarding anything.
The possible downside to that is does .filter even evaluate functions?

Idea 2. is that I write a shell script that is called from .forward
instead of filter which looks at the time and decides which filter
statement to run.

Which idea looks more feasible?

Alice Pinard
(who knows that nothing is truly impossible with *nix, it's just a matter
of how much pain one is willing to endure to get the result)

 
 
 

.forward/elm filter/time question

Post by era eriksso » Sun, 26 Oct 1997 04:00:00



posted to comp.unix.questions,dnaco.unix:
 > back... My boyfriend then sends me email saying 'ok that's good but can
 > you set it up to only work between 8am and 5pm.
 > Hmmm.. I _could_ try and learn procmail... but don't feel like it.

Why on Earth not?

You could start up with something to only do the parts that filter
can't do for you, then slowly upgrade.

    # This assumes From_ lines on your mail looks like

    # We want to look at only the ^^^^^^^^ time stamp
    # and we want it to be between 08:00:00 and 16:59:59, inclusive
    # (actually, then, checking for 08 thru 16 is sufficient).

    :0  # Whitespace in brackets consists of a space and a tab
    * ^From [^  ]+[     ]+... ... [ 1][0-9] ([ 0][89]|1[0-6]):
    | /path/to/filter -options

    # If we didn't match on the previous recipe, we're still running.
    # Dropping off the end of the .procmailrc will deliver the mail to
    # your normal mailbox.

 > I _could_ try to play with cron jobs... but since I'm not an admin

Don't you already need cron jobs to clean up after filter when it
dumps core on you? ;^/

 > Idea 2. is that I write a shell script that is called from .forward
 > instead of filter which looks at the time and decides which filter
 > statement to run.

This is what Procmail does, and really all it does (only it probably
is better at protecting you from unexpected havoc than your average
home-grown program, and it looks at anything in the environment or the
incoming message, not just the time). The rest is just regular
expressions and shell script snippets.

BTW, there is a tool for translating filter rules to Procmail rules at
<http://www.forwiss.uni-passau.de/~ramsch/Software/ef2p/index.phtml.en>
and links to a lot of tutorials and other stuff on my Procmail links
page at <http://www.iki.fi/~era/procmail/links.html>

Hope this helps,

/* era */

[Added comp.mail.misc; followups to same]

--
 Paparazzi of the Net: No matter what you do to protect your privacy,
  they'll hunt you down and spam you. <http://www.iki.fi/~era/spam/>

 
 
 

1. Elm filter rules - .forward file reference

   I'm trying to set up a simple rule to be used by the filter program
and am not having much success.   I'm running Elm 1.5b under version
2.0 of Gould's UTX OS.  I don't know what version of filter I have.

   The filter rule works fine when I test it interactively by piping
the output of readmsg into filter, so I'm inclined to believe that
the rule is OK.  Just in case here my ~/.filter-rules file:

-------------------------------------------------------------------
#
# ~/.filter-rules
#
# Filter rules for the Elm filter program
#

# rule 1
if (lines >= 1) then savecopy "/u7/gregg/mail/mail.recvd.%m"
--------------------------------------------------------------------

   I've have tried all of the following in my ~/.forward file with
the same results - all mail is deleted, with no (noticable) filter
errors being produced.

   |filter
   "|filter"
   "|filter >> /u7/gregg/.filter_errors 2>&1"

   Can and would someone please help me determine what I'm doing
wrong or why this isn't working?

   Please e-mail responses to me since there is problably some
simple reason that everyone (else) is aware of.  I'll post the
answer(s) to the net if I receive more than a couple of requests
for a copy of the answer(s)

Thanks,
Gregg
--
Gregg Zupcsics                       {allegra|codas}!novavax!utx1!gregg
Racal-Milgo, P.O. Box 407044, Fort Lauderdale, Fl 33340, (305) 476-6332

2. awk,sed, or lex question

3. mail filtering problem using elm filter

4. Where can I find a BSD-ftpd FAQ/HOWTO ?

5. ELM filter question

6. Disabling Processors on MP

7. 'filters' in 'elm'

8. Crash test and warning

9. filter rules in elm

10. elm filter eating up my processes[2~...

11. Filtering with Elm?

12. elm mail-filter

13. how to filter elm spam?