mdf@osu-eddie.UUCP (Mark D. Freeman) (01/09/87)
We would like to be able to have a file for each user, which specifies the names/aliases to which they are allowed to send mail. Mail from a particular user which is not sent to one of the listed names/aliases should be bounced back to the sending user with some appropriate header. Is this possible? Has anyone done it? -- < < < < < < < < < < < < < < < < < < < <> > > > > > > > > > > > > > > > > > > > Mark D. Freeman mdf@osu-eddie.uucp InfoSolv Corporation mdf@Ohio-State.arpa 6099 Riverside Drive ...!cbosgd!osu-eddie!mdf Dublin, OH 43017 Guest account at The Ohio State University (614) 761-8444 < < < < < < < < < < < < < < < < < < < <> > > > > > > > > > > > > > > > > > > >
jc@cdx39.UUCP (John Chambers) (01/13/87)
> We would like to be able to have a file for each user, which specifies > the names/aliases to which they are allowed to send mail. > > Is this possible? Has anyone done it? > Well, I've done something rather similar, so what you want oughta be easy, too. What I did was actually an interface between uucp mail and a local in-house mailer, which I'll call foomail. The puzzle in this case, of course, is not how to restrict the mail to certain recipients; I wanted to maximize the list of recipients. But the technique does both equally well. Incoming uucp mail is handled by executing a program called 'rmail', which is normally linked to 'mail', both in /bin. To extend the mailer, you just unlink /bin/rmail, and replace it with your own script. If you want to intercept outgoing mail, move /bin/mail somewhere secret, and put your script in with both names. This script will be called with $1 containing the mailpath, and the message on standard input. It is easy to write a series of tests: if [ sometest $1 ] then somemailer $1 if [ $? -eq 0 ] then exit 0 fi fi repeated for as many different tests as you like. For instance, you can invoke a test program that looks the recipient up in a database. You can also make a copy of the message: cat >>/tmp/msg$$ and pass its name to your test program. This lets you examine it to determine the sender, or make tests on the subject matter, or scan it for keywords, etc. [This is what the CIA and NSA do to anything you mail outside the country. :-] Just remember to delete the scratch file when you're done. One thing I did that has come in very handy is to have a special mail-forwarding directory $F that may contain executables. My rmail script then sets $R to the recipient and does: if [ -x $F/$R ] then echo "There is a forwarding script for '"$R"'." if $F/$R $R /tmp/msg$$ then echo "Delivered by '"$F/$R $R"'." continue fi echo "Failure by '"$F/$R $R"'." date stat = 1 continue fi Users can then send mail to the mail-handling script as if it were an ordinary user, and the script will process the message. This should give you lots of ideas about how to impose your own processing on mail. Try it; it's easy! -- John M Chambers Phone: 617/364-2000x7304 Email: ...{adelie,bu-cs,harvax,inmet,mcsbos,mit-eddie,mot[bos]}!cdx39!{jc,news,root,usenet,uucp} Smail: Codex Corporation; Mailstop C1-30; 20 Cabot Blvd; Mansfield MA 02048-1193 Clever-Saying: If we can't fix it, it ain't broke.