Article View: comp.mail
Article #5Re: Intercepting incoming mail...
From: Allan E Johannesen
Date: Mon, 03 Aug 1992 18:43
Date: Mon, 03 Aug 1992 18:43
47 lines
1522 bytes
1522 bytes
Assuming you use sendmail, define a mailer.
Msomename, P=/usr/coconut/someprog, F=lsDFMe, S=10, R=20, A=someprog $u
S10
R@ $n errors to mailer-daemon
Then insert this into S0:
# handle special cases
R$*<@tofile> $#somename:$1
R$*<@tofile.$m> $#somename:$1
The $m is the domain name here. It may be something else in your
sendmail. In this instance, mail to:
somebody@tofile
or somebody@tofile.domain.name
will be sent through someprog, which could be a shell...
someprog.c might be
#include <stdio.h>
char
line[100];
FILE
*F;
main(argc,argv)
int
argc;
char
**argv;
{ if (F = fopen("/usr/coconut/someprog.log","a"))
{ int
j;
fprintf(F,"argc = %d\n",argc);
for (j = 0; j < argc; j++)
fprintf(F,"argv[%d] = %s\n",j,argv[j]);
while (fgets(line,100,stdin))
fputs(line,F);
fclose(F);
exit(0); };
exit(1); }
Technical Details
Message-ID:
<AEJ.92Aug3134306@manyjars.WPI.EDU>Path:
arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!wpi.WPI.EDU!nntp!aejReferences:
<1992Aug02.212009.12056@crash>Show Full Headers
Complete Article Headers
Newsgroups: comp.mail,comp.unix.wizards Path: arc1-ca.pugleaf.net!sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!news.Brown.EDU!noc.near.net!wpi.WPI.EDU!nntp!aej From: aej@manyjars.WPI.EDU (Allan E Johannesen) Subject: Re: Intercepting incoming mail... In-Reply-To: coconut@crash.cts.com's message of 3 Aug 92 04:20:08 GMT Message-ID: <AEJ.92Aug3134306@manyjars.WPI.EDU> Sender: news@wpi.WPI.EDU (USENET News System) Nntp-Posting-Host: manyjars.wpi.edu Organization: Worcester Polytechnic Institute, Worcester, MA 01609-2280 References: <1992Aug02.212009.12056@crash> Date: Mon, 3 Aug 1992 18:43:06 GMT Lines: 47