[comp.unix.questions] changing mail directory

pjh@mccc.UUCP (Pete Holsberg) (09/29/88)

SysV puts incoming mail in /usr/mail/<login>.  Is there a way to change
that (without patching source code)?  I thought that the MAIL
environmental variable controlled the destination, but someone suggested
that since it is uucp that is "logging in" and is using uucici as its
shell, it doesn't look at MAIL.

Thanks.

Pete Holsberg                   UUCP: {...!rutgers!}princeton!mccc!pjh
Technology Division                   ...!att!jonlab!mccc!pjh
Mercer College			CompuServe: 70240,334
1200 Old Trenton Road           GEnie: PJHOLSBERG
Trenton, NJ 08690               Voice: 1-609-586-4800

dave@westmark.UUCP (Dave Levenson) (10/03/88)

In article <286@mccc.UUCP>, pjh@mccc.UUCP (Pete Holsberg) writes:

> SysV puts incoming mail in /usr/mail/<login>.  Is there a way to change
> that (without patching source code)?  I thought that the MAIL
> environmental variable controlled the destination, but someone suggested
> that since it is uucp that is "logging in" and is using uucici as its
> shell, it doesn't look at MAIL.

The problem is that your MAIL environment variable is your own.  You
can change it when you log in, but it doesn't change the value used
by everyone else on your machine, especially rmail -- the process
spawned by the uux rmail command that is received and processed by
uucico when mail is received on your machine.

You will probably need to re-compile rmail to accomplish what you
want.

-- 
Dave Levenson
Westmark, Inc.		The Man in the Mooney
Warren, NJ USA
{rutgers | att}!westmark!dave

pjh@mccc.UUCP (Pete Holsberg) (10/05/88)

In article <390@westmark.UUCP> dave@westmark.UUCP (Dave Levenson) writes:
...You will probably need to re-compile rmail to accomplish what you
...want.

That'll be hard without source code!

...-- 
...Dave Levenson
...Westmark, Inc.		The Man in the Mooney

Mooney!  How about flying into Twin Pine or TTN and taking me for a
ride?  What model??

itkin@mrspoc.UUCP (Steven M. List) (10/07/88)

In article <305@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes:
> In article <390@westmark.UUCP> dave@westmark.UUCP (Dave Levenson) writes:
> > You will probably need to re-compile rmail to accomplish what you
> > want.
> That'll be hard without source code!

Not if you use smail.  It lets you specify all sorts of things and, of course,
being available on the NET includes source code.  It's reasonably easy to
build and install and also provides a GOOD mailer with aliases and
routing.
-- 
:  Steven List @ Transact Software, Inc.
:  {coherent,mips,satyr,ubvax}!mrspoc!itkin
:  Voice: (415) 961-6112

dtynan@sultra.UUCP (Der Tynan) (10/08/88)

In article <1162@mrspoc.UUCP>, Steven M. List writes:
> In article <305@mccc.UUCP> Pete Holsberg writes:
> > In article <390@westmark.UUCP> Dave Levenson writes:
> > > You will probably need to re-compile rmail to accomplish what you
> > > want.
> > That'll be hard without source code!
> 
> Not if you use smail.  It lets you specify all sorts of things and, of course,
> being available on the NET includes source code.
> :  Steven List @ Transact Software, Inc.

Sorry to break it to you Steven, but smail won't help in this case.  I know,
because I *used* to use the braindead SysV mailer.  smail, which, by the way,
is a *great* package DOES NOT deliver the message.  It uses the original
distribution mail program (which is moved to /bin/lmail) to actually put the
mail in the spool directory (which remains /usr/mail/xxxxx).  The actual
tasks done by SysV mail (I'll refer to it as lmail) in delivering mail, are
very straightforward.  I'm surprised that Horton et al didn't just rewrite
this mechanism.  They didn't however, so the solution to the original posters
problem, is to rewrite lmail.  AND, of course, upgrade (and I do mean UPGRADE)
to smail.  That's what I did, and besides some early teething problems, the
mail system ain't half bad now.  Also, mail is kept in /usr/spool/mail!!!
						- Der
-- 
Reply:	dtynan@sultra.UUCP		(Der Tynan @ Tynan Computers)
	{mips,pyramid}!sultra!dtynan
	Cast a cold eye on life, on death.  Horseman, pass by...    [WBY]

andys@genesis.ATT.COM (a.b.sherman) (10/12/88)

In article <1162@mrspoc.UUCP> itkin@mrspoc (Steven M. List) writes:
>In article <305@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes:
>> In article <390@westmark.UUCP> dave@westmark.UUCP (Dave Levenson) writes:
>> > You will probably need to re-compile rmail to accomplish what you
>> > want.
>> That'll be hard without source code!
>
>Not if you use smail.  It lets you specify all sorts of things and, of course,
>being available on the NET includes source code.  It's reasonably easy to
>build and install and also provides a GOOD mailer with aliases and
>routing.


Ah, but what was the original question?  How can one change the mailbox
directory from /usr/mail to /foo/bar?  Smail does *NOT* handle local
mail delivery.  Local mail delivery is passed to a program usually
called /bin/lmail.  "What is /bin/lmail?" I hear you ask.
/bin/lmail is the original /bin/[r]mail that came with your system.
To change local delivery, you still need the source to the vanilla
/bin/mail that ships with your operating system.
-- 
andy sherman / at&t bell laboratories (medical diagnostic systems)
room 2e-108 / 185 monmouth pkwy / west long branch, nj 07764-1394
(201) 870-7018 / andys@shlepper.ATT.COM
...The views and opinions are my own.  Who else would want them?

pdb@sei.cmu.edu (Patrick Barron) (10/12/88)

In article <484@genesis.ATT.COM> andys@shlepper.ATT.COM (a.b.sherman) writes:
>To change local delivery, you still need the source to the vanilla
>/bin/mail that ships with your operating system.

Or, you could always use my favorite solution - just crank up emacs
(or whatever your favorite editor is, but not ed or ex/edit/vi, 'cause
they can't do this), and change it in the binary.  Just as long as
the string you're changing is of equal or greater length than what you're
changing it to, you'll be fine.  Be careful not to change the total size
of the file.  Sort of grody, but it works.

--Pat.

zeeff@b-tech.ann-arbor.mi.us (Jon Zeeff) (10/12/88)

In article <484@genesis.ATT.COM> andys@shlepper.ATT.COM (a.b.sherman) writes:
>
>directory from /usr/mail to /foo/bar?  Smail does *NOT* handle local
>mail delivery.  Local mail delivery is passed to a program usually
>To change local delivery, you still need the source to the vanilla
>/bin/mail that ships with your operating system.

I'll send source for my version of lmail to anyone who wants it.  It
replaces the lmail you have and adds piping to commands and files.


-- 
Jon Zeeff      			Branch Technology,
umix!b-tech!zeeff  		zeeff@b-tech.ann-arbor.mi.us

mmengel@cuuxb.ATT.COM (Marc W. Mengel) (10/12/88)

In article <484@genesis.ATT.COM> andys@shlepper.ATT.COM (a.b.sherman) writes:
>In article <1162@mrspoc.UUCP> itkin@mrspoc (Steven M. List) writes:
>>In article <305@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes:
>>> In article <390@westmark.UUCP> dave@westmark.UUCP (Dave Levenson) writes:
>>> > You will probably need to re-compile rmail to accomplish what you
>>> > want.
>>> That'll be hard without source code!
>>Not if you use smail. 
>
>Ah, but what was the original question?  How can one change the mailbox
>directory from /usr/mail to /foo/bar?  Smail does *NOT* handle local
>mail delivery.  Local mail delivery is passed to a program usually
>called /bin/lmail.  "What is /bin/lmail?" I hear you ask.
>/bin/lmail is the original /bin/[r]mail that came with your system.
>To change local delivery, you still need the source to the vanilla
>/bin/mail that ships with your operating system.

Well, actually, for local mail deleivery only you could just use
the following script, made complicated only by the mail lock file.
(You might want to modify it to forcibly remove the lock if it spins
in the until loop enough times...)

	fromname=$LOGNAME
	maildir=/usr/mail
	for toname in $*
	do
		umask 222
		until > ${maildir}/${toname}.lock
		do
			sleep 5
		done
		umask 077
		echo From ${fromname} `date` >> ${maildir}/${toname}
		sed -e 's/^From />&/'        >> ${maildir}/${toname}
		rm -f ${maildir}/${toname}.lock
	done

jbm@uncle.UUCP (John B. Milton) (10/14/88)

In article <2126@cuuxb.ATT.COM> mmengel@cuuxb.UUCP (Marc W. Mengel) writes:
>In article <484@genesis.ATT.COM> andys@shlepper.ATT.COM (a.b.sherman) writes:
>>In article <1162@mrspoc.UUCP> itkin@mrspoc (Steven M. List) writes:
>>>In article <305@mccc.UUCP> pjh@mccc.UUCP (Pete Holsberg) writes:
>>>> In article <390@westmark.UUCP> dave@westmark.UUCP (Dave Levenson) writes:
>>>> > You will probably need to re-compile rmail to accomplish what you
>>>> > want.
>>>> That'll be hard without source code!
>>>Not if you use smail. 
>>
>>Ah, but what was the original question?  How can one change the mailbox
...
>Well, actually, for local mail deleivery only you could just use
>the following script,
...

How about the easiest way of all: patch the executable! The string "/usr/mail/"
only appears once in my (UNIXpc) version. You would be limited to 10 characters,
of course. The program bpatch, buggy though it is will do this just fine. The
same patch would have to be applied to /etc/smgr on the UNIXpc if you still
want the letter icon to come up correctly. The string appears three times there.
Any other programs that reference that directory, as long as they have the
entire path in one place, could be fixed this way.

One of my favorite file-name-in-the-executable path changes was to patch
/usr/lib/uucp/*getty to change the /dev/syscon reference to /dev/error. This
way the error comes up in a nice clean window instead of flashing a new window
for a second.

John (there's always an easier way) Milton
-- 
John Bly Milton IV, jbm@uncle.UUCP, n8emr!uncle!jbm@osu-cis.cis.ohio-state.edu
home (614) 294-4823, work (614) 764-4272;  Send vi tricks, I'm making a manual