procmail
[Top] [All Lists]

Re: [Q] Exit Code/Forward Email

1996-01-19 21:18:26
Sri Sriram <shrim(_at_)thunder(_dot_)ocis(_dot_)temple(_dot_)edu> writes:
Procmailers,

I have two questions:

1- What is the pertinent "Exit" code that goes into the ".forward"
file for Procmail 3.10 to work on a SunOS 4.1.3 machine.

The same as on any other: the code are defined by sendmail.  The
question is what do you want sendmail to do if it hits that exit.  If
you want to have sendmail retry the message, then you would exit with
code 75.  Why 75?  Take a look at /usr/include/sysexits.h  The compile
constant used by sendmail EX_TEMPFAIL is defined to be 75.  Similarly,
if you wanted sendmail to bounce the message you would pick an
appropriate code, depending on what sort of error you wanted it to
appear as, i.e., if you wanted to bounce messages over a certain size,
you could return 65 (EX_DATAERR), 69 (EX_UNAVAILABLE), or (if you're
feeling ironic) 66 (EX_NOINPUT).



2- Is there an recipe avail. which will do the following: Based on the
^From and ^Date (mail arrival time) forward the message to another
e-mail address at a scheduled later time? Ex: All mail coming from
steve(_at_)proc(_dot_)com between the time 10:00 PM and 7:30 AM be sent to
joe(_at_)foo(_dot_)com at 7:31 AM the following day ?

1) The Date: header generally contains the _originating_ date.  The
arrival date can usually be obtained from the "From " header.

2) Procmail is only run on the arrival of message.  The timed sending
at 7:31am would therefore have to be done by a cron job.

3) Procmail doesn't contain a date parser, so we'll have to fake it.
You'll have to tweak the example below to follow your mail delivery
agent's format.  Mine uses something like
    From procmail-request(_at_)Informatik(_dot_)RWTH-Aachen(_dot_)DE  Fri Jan 
19 02:08:09 1996
(which was off your message in my mailbox).


:0
*       ^From: steve@([a-z0-9-_]+\.)*proc\.com
*       ^From .* [MTWFS].. [JFMASOND].. [0-9]+ (2[23]|0[0-6]|07:[012])
to-go-out-in-the-morning-mailbox


Then you would run a cron job like this:

31 7 * * * /usr/local/bin/formail -I "Resent-To: joe(_at_)foo(_dot_)com" -s 
/usr/lib/sendmail -oi joe(_at_)foo(_dot_)com < 
$HOME/whereever/to-go-out-in-the-morning-mailbox


The -I "Resent-To..." bit is optional, but can be handy for tracing how a
message managed to end up in your mailbox.  Sendmail will add "Resent-From:"
and "Resent-Date:" headers to go with it if you do use it.


All of the above was done off the top of my head with only minor
peaking at manpages, so you should be extremely careful in implementing
such a system.  Indeed, any such hacking should only be done under the
care of and after consulting with your doctor and local guru, blah blah
blah blah blah.


Philip Guenther

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