Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!ncis!helios.ee.lbl.gov!pasteur!agate!bionet!csd4.milw.wisc.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!cs.utexas.edu!ut-emx!mariou From: mariou@ut-emx.UUCP (Mariou Barr) Newsgroups: comp.unix.questions Subject: Re: Undesirable Mail Message-ID: <9541@ut-emx.UUCP> Date: 17 Jan 89 21:32:33 GMT References: <9379@ut-emx.UUCP> <810030@hpsemc.HP.COM> Organization: The University of Texas at Austin, Austin, Texas Lines: 229 In article <810030@hpsemc.HP.COM>, gph@hpsemc.HP.COM (Paul Houtz) writes: > > O.K., Mariou, > > Since you are so grateful for the help, why don't you post a summary > of your responses. I would like to know the answer to your question > as well but have seen no reponses on Usenet. =============================== Yes of course Paul. Here we go. This is kind of long though. I have elimininated the names, because I do not like to disclose peoples' identities without their consent. I hope it is OK. ======= ======= ======= Subject: Re: Undesirable Mail Summary: Baboon extermination In article <9379@ut-emx.UUCP> you write: >Is there a way I can keep away from me >undesirable mail? I did try putting in >my .mailrc: > >delete baboon@zoo.utexas.edu > >The result a big naught. The mail goes through anyway. >Does anyone have a way of doing this? >And would he/she be kind enough to share? That should have worked. Though I've always just used 'd' instead of spelling it out 'delete'. (This shouldn't make a difference.) Though mail is kind of picky about how it recognizes the name. The way the address looks on a 'h' command _should_ work for you. You may have to play with several variations, which you can do at the mail program's command level. When you find the one that mail recognizes, you can put that command in your .mailrc file. & d baboon@zoo.utexas.edu No applicable messages & d !zoo.utexas.edu!baboon 143 messages deleted A friend of mine subscribes to a zillion mailing lists, and uses this in his .mailrc file to pre-sort them all: s sunspots@what.ever sun-mail d sunspots@what.ever -- ============================= To: mariou@ut-emx.UUCP Subject: Re: Undesirable Mail Newsgroups: comp.unix.questions In article <9379@ut-emx.UUCP> you write: > >Is there a way I can keep away from me >undesirable mail? I did try putting in >my .mailrc: > >delete baboon@zoo.utexas.edu > >The result a big naught. The mail goes through anyway. >Does anyone have a way of doing this? >And would he/she be kind enough to share? > >With very many thanks -- for any help anyone >can give me. > >Mariou Voulgari Barr >e-mail: mariou@walt.cc.utexas.edu My suggestion is to return one copy to the sender, and one to the postmaster@senders.site, without reading it (the first two or three with a polite note attached for the benefit of the postmaster). ELM has a nice "F" feature or for just that sort of use.... If the mail persists, try sending 10 copies (+/- however annoying the mail is) :-) This technique is remarkably effective. ============================================= What I describe below works under my system's mailer. I don't know if it will work with yours. If you're unfamiliar with UNIX and something below is confusing, ask me about it. I have .forward in my home directory set up as follows: "| /b/bernsten/.mailserver; exit 0" What my mailer does with this is sends mail originally going to bernsten through the pipe "| /b/bernsten/.mailserver; exit 0" (the exit 0 is so that the mailer doesn't get spurious errors). If I wanted mail also to go to /usr/spool/mail/bernsten, I would include the line \bernsten in .forward; but I have .mailserver do that for me. When the mailer wants to give me mail it obligingly forwards it through .mailserver (which must be exeuctable, as in chmod 700) in my home directory: #!/bin/sh umask 77 cat > /usr/spool/mail/bernsten$$ echo '' >> /usr/spool/mail/bernsten$$ cat /usr/spool/mail/bernsten$$ >> /usr/spool/mail/bernsten cat /usr/spool/mail/bernsten$$ >> /usr/spool/mail/bernsten.log if (grep '^Subject: *!POLL' /usr/spool/mail/bernsten$$) then cat /usr/spool/mail/bernsten$$ >> /usr/spool/mail/bernsten.poll fi rm -f /usr/spool/mail/bernsten$$ (Note that this is not run as root so you can't break into the system this way.) .mailserver runs under sh, removes access by group and others to the files it touches, puts the mail it gets into bernsten$$ (here $$ gives the shell process ID) followed by an extra line (otherwise messages can get stuck together). Then it adds the message to bernsten and bernsten.log; and if the message contains Subject: at the beginning of a line followed by !POLL it dumps the message into bernsten.poll as well. Finally, it removes the temporary file. If you're unfamiliar with shell programming, try the following as a start for .mailserver: #!/bin/sh umask 77 # Put the message into mariou$$. cat > /usr/spool/mail/mariou$$ echo '' >> /usr/spool/mail/mariou$$ # Save the message in mariou.log... you may not want this. cat /usr/spool/mail/mariou$$ >> /usr/spool/mail/mariou # Do we put it into mariou or mariou.ugh? if (grep '^From:' /usr/spool/mail/mariou$$ | grep 'idiot@work.not.edu') then cat /usr/spool/mail/mariou$$ >> /usr/spool/mail/mariou.ugh else cat /usr/spool/mail/mariou$$ >> /usr/spool/mail/mariou fi # Get rid of the temporary file rm -f /usr/spool/mail/mariou$$ If you have lots of people to delete mail from, change the grep 'idiot...' to fgrep -f filewiththeirnames, where the file might be idiot@work.not.edu idiot@home conscience@brain ========================================== } Is there a way I can keep away from me } undesirable mail? I did try putting in } my .mailrc: } } delete baboon@zoo.utexas.edu } } The result a big naught. The mail goes through anyway. } Does anyone have a way of doing this? } And would he/she be kind enough to share? } } With very many thanks -- for any help anyone } can give me. } } Mariou Voulgari Barr } e-mail: mariou@walt.cc.utexas.edu The easiest thing you can probably do is use "mush", the Mail User's Shell, for reading your mail. I obviously don't know whether this program is available on your system, though it is becoming fairly common. If you can wait a few weeks, a new release will soon be appearing on comp.sources.unix. If you are really in a hurry, send mail to the author, island!argv@cad.berkeley.edu (Dan Heller). Mush differs from the standard mail program in a number of ways, but the important one for your problem is that you can tell it to read a start-up script of commands, which can include selecting messages for deletion. So the messages will still get delivered, but you can have mush delete them before you ever see them. Another solution is to use a filtering program called via a ".forward" file. If you have a file named .forward in your home directory, some mail delivery programs (notably sendmail, which is the most common one) will read that file for insturctions on where to deliver your mail. The .forward file can tell sendmail to deliver the mail to a program you have written. The program can do anything you want with the mail, and although most such programs usually finish by saving the mail in your system mailbox, you can certainly have the program throw away mail that you don't want to see. I have written a program called mxp that can be used in this manner from a .forward file, but it is BSD UNIX specific, so if you are using SysV or another OS it won't work. If your system will handle .forward files, and you are interested in my program, let me know and I'll send you a copy. Or you can write your own -- ask somebody there for info about using .forward files. Hope this helps! } Subject: Re: Undesirable Mail My .forward file contains the single line below: "|/ogc/students/schaefer/bin/mxp" Including the quotation marks. This means "pipe the incoming mail to the program mxp found in /ogc/students/schaefer/bin". mxp is the program I mentioned in my last message. You can also put any valid e-mail address in .forward, in which case ALL of your mail will be sent to the forwarding address. Be careful of loops -- that is, don't forward mail to your own address or to any address where there is another .forward file that sends it back to you. ========================================== If you're running a Berkeley sort of Unix, you can set up a filter in your .forward file to scan all your incoming mail and delete the ones you want to. This is even easier if you are running the MH mail system, too. If you're running System V, you probably lose. If the only thing you can modify is your .mailrc, then you definitely lose - /usr/ucb/Mail (or mailx) has no way to do this. ==========================================