[comp.mail.mh] MH Blues

wiseb@turing.cs.rpi.edu (G. Bowden Wise) (10/24/90)

I have just recently started using slocal to do a few things like
incorporate incoming mail from certain sources automatically.  I have
no problem getting my mail incorporated into some folders be selecting
the mail by the From field in the .maildelivery file.  But, what I
would also like to be able to do one of the following additionail
actions: 

(1) Have mail that is not delivered to a folder remain in my system
    mail drop until, I 'inc' it into my inbox.  This is what I am
    trying to do currently.  But, what happens is suppose that I have 
    two new mail messages, when I do the 'inc' only the first message
    appears in the inbox; the other message has been appended to the 
    end of the first message!  What is making 'inc' not put each
    message in a separate file in the inbox??

    I thought that the problem was related to the fact that by
    default, mail that is not delivered gets incorporated into one
    mail file.  So, I tried overriding the default process, but this 
    did not solve the problem.  See my .maildelivery file below for
    my default set up.

(2) The other scenario I would like to be able to do is have all my
    incoming mail automatically incorporated into my 'inbox'.  I 
    believe I have the same problem as I mentioned in number 1, but 
    I cannot remember for sure.  But, one thing I dont like when I do 
    this is that I no longer get notificatin that I have recieved
    mail.  I have tried using 'rcvtty' but to no avail.  Also, is
    there a way to let the X Windows client xbiff know that mail has
    been received?

Below are my .forward and .maildelivery files, currently implementing
scenario number 1 described above:

"| /usr/local/lib/mh/slocal -user wiseb"


# .mail delivery file follows-------
#field   pattern  action  result  string

# Receive mail from rdist into folder +rdist
From     rdist    |       A       "/usr/local/lib/mh/rcvstore +rdist"

# Receive mail from "at" jobs into folder +atjobs
Subject  "Output from"   |       A       "/usr/local/lib/mh/rcvstore +atjobs"

# To incorporate all mail automatically into +inbox - disabled
#default  -        |       A       "/usr/local/lib/mh/rcvstore +inbox"

# do nothing with mail that doesnt match
default  -        |       R      ""

--------------------------------------------------------------------------
Thanks in advance for any pointers on what I am doing wrong; and I
apologize for the length of this message!




--
----------------------------------------------------------------
- Bowden Wise, RPI, Computer Science Department, Troy, NY  12180
  internet: wiseb@turing.cs.rpi.edu      bitnet: bowden@rpitsmts

ziegast@ENG.UMD.EDU (Eric Ziegast) (10/25/90)

"G. Bowden Wise" writes:
>I have just recently started using slocal to do a few things like
>incorporate incoming mail from certain sources automatically.  I have
>no problem getting my mail incorporated into some folders be selecting
>the mail by the From field in the .maildelivery file.  But, what I
>would also like to be able to do one of the following additionail
>actions: 
>
>(1) Have mail that is not delivered to a folder remain in my system
>    mail drop until, I 'inc' it into my inbox.  This is what I am
>    trying to do currently.  But, what happens is suppose that I have 
>    two new mail messages, when I do the 'inc' only the first message
>    appears in the inbox; the other message has been appended to the 
>    end of the first message!  What is making 'inc' not put each
>    message in a separate file in the inbox??

Sucks, don't it? The problem is that the "file" (aka ">") action
thakes the message and "appends" it to the file.  If it were to
correctly do this so that both inc and /usr/ucb/Mail could read
them as seperate messages, it would have to append a blank line and
then the message to the file.  The blank line must come before
the first "From " in the message in order for it to be considered as
a seperate message.  This isn't RFC822, but we live with it anyway.
So all that has to be done is change the source so that it does
fprintf(mailfile,"\n") before it appends the message to the mail
file. I might try this fix, but I've got more important things to do.

>    I thought that the problem was related to the fact that by
>    default, mail that is not delivered gets incorporated into one
>    mail file.  So, I tried overriding the default process, but this 
>    did not solve the problem.  See my .maildelivery file below for
>    my default set up.

The following line is closest to the default for slocal:

	default - > ? /var/spool/mail/user

but I'd prefer:

	default - ^ ? "/usr/local/lib/mh/rcvstore +inbox"

So that it will be at least seperated from the rest of the messages.

>(2) The other scenario I would like to be able to do is have all my
>    incoming mail automatically incorporated into my 'inbox'.  I 
>    believe I have the same problem as I mentioned in number 1, but 
>    I cannot remember for sure.  But, one thing I dont like when I do 
>    this is that I no longer get notificatin that I have recieved
>    mail.  I have tried using 'rcvtty' but to no avail.  Also, is
>    there a way to let the X Windows client xbiff know that mail has
>    been received?

Maybe you should try:

	default - ^ ? "/usr/local/lib/mh/rcvstore +newbox"

and have your MAIL variable point to ~/Mail/newbox/1.

If you have any "new" mail, there will be a (exactly one) message in
~/Mail/newbox/1 and your xbiff icon will beep and light up.  You must
use "setenv MAIL ~/Mail/newbox/1" before you start xbiff.  Otherwise, 
it'll probably point to /var/spool/mail/$user where you will never get 
new mail.

To "incorperate" your new mail in +newbox to your folder +inbox,
use:

	alias inc 'refile -src +newbox all +inbox'

So when you use "inc", all of your new messages will move to your inbox
and your xbiff will turn off since there is no message 1 in +newbox.

With no messages in +msgbox, slocal will once again fill it starting
with message 1 (xbiif goes beep again :-) until you once again "inc"

This is one solution of many. If worse comes to worse, you could always
write shell scripts to make MH do what you want.


Also, another pet peeve with slocal:
Why is it that there is no search filed which looks for an address in
both "To:" and "cc:"?  Here's what my .maildelivery looks like:

# Maildelivery file used by slocal
To      staff              ^ ? "/usr/local/mh/lib/rcvstore +staff"
Cc      staff              ^ ? "/usr/local/mh/lib/rcvstore +staff"
To      dumpers            ^ ? "/usr/local/mh/lib/rcvstore +ecs"
Cc      dumpers            ^ ? "/usr/local/mh/lib/rcvstore +ecs"
To      xwindows           ^ ? "/usr/local/mh/lib/rcvstore +ecs"
Cc      xwindows           ^ ? "/usr/local/mh/lib/rcvstore +ecs"
To      serpent-           ^ ? "/usr/local/mh/lib/rcvstore +serpent"
Cc      serpent-           ^ ? "/usr/local/mh/lib/rcvstore +serpent"
To      mh-                ^ ? "/usr/local/mh/lib/rcvstore +mh"
Cc      mh-                ^ ? "/usr/local/mh/lib/rcvstore +mh"
To      info-matrix        ^ ? "/usr/local/mh/lib/rcvstore +matrix"
Cc	info-matrix        ^ ? "/usr/local/mh/lib/rcvstore +matrix"
  ... etc ...
default -                  ^ ? "/usr/local/mh/lib/rcvstore +other"

It's a pain in the neck when you you get a message from a mailing list
that people send to ("To:") or reply to ("Cc:") and need to sort it.

P.S. This message bounced so my last massage refers to this one.
________________________________________________________________________
Eric W. Ziegast, University of Merryland, Engineering Computing Services
ziegast@eng.umd.edu - Eric@[301.405.3689]

wisner@hayes.ims.alaska.edu (Bill Wisner) (10/26/90)

>>(1) Have mail that is not delivered to a folder remain in my system
>>    mail drop until, I 'inc' it into my inbox.

>Sucks, don't it? The problem is that the "file" (aka ">") action
>thakes the message and "appends" it to the file.

So don't use the "file" action. Don't bother trying to keep your
mailbox in Berkmail format. From my .maildelivery:

default	-	pipe ?	"/usr/local/lib/mh/rcvpack /var/spool/mail/wisner"
*	-	pipe R	"/usr/local/lib/mh/rcvtty -biff"

You will not be able to use any "traditional" software to manipulate
your mailbox since the messages will be stored in MMDF format. But
then, who cares?

Bill Wisner <wisner@hayes.fai.alaska.edu> Gryphon Gang Fairbanks AK 99775
"I hate quotations." -- Ralph Waldo Emerson

rhall@convex.COM (Randy Hall) (10/26/90)

>So don't use the "file" action. Don't bother trying to keep your
>mailbox in Berkmail format.
>
>You will not be able to use any "traditional" software to manipulate
>your mailbox since the messages will be stored in MMDF format. But
>then, who cares?

I found it wasn't that hard to store messages in that format.  I don't know
why slocal doesn't.  I use this line in my .maildelivery:

default - | ? "echo \"From $(sender) `date | sed -e 's/C[DS]T //'`\" >> /usr/spool/mail/rhall; /bin/sed -e '/^Return-Path/s//Xtra-&/' >> /usr/spool/mail/rhall; echo >> /usr/spool/mail/rhall"

It echos a From line with the date.  It modifies the Return-Path so I don't
end up with two of them (messed me up when I used repl).  And the most
important part is it echos a blank line.

It doesn't look too pretty, but it works like a champ for me.

Randy Hall  (rhall@convex.com)

dhesi%cirrusl@oliveb.ATC.olivetti.com (Rahul Dhesi) (10/27/90)

The question is:  How do you make mhook/slocal put certain messages
into your system mailbox in standard BSD/UNIX format?

My solution has been to (a) figure out how local mailbox delivery
is done on your system and (b) invoke that mechanism.

When your mail router wants to put a message into your physical
mailbox, it does so through some mechanism that does file locking.  If
your system uses sendmail, the local mailer delivery program invoked is
probably /bin/mail or /bin/lmail or some such thing.  Just invoke this
program from your .maildelivery file.

The last few lines in my .maildelivery file are:

     default - | ? "/usr/bin/mail -d dhesi"
     default -  | ? "/cirrus/lib/mh/lib/rcvstore +inbox -create"

First I try to deliver mail into my maildrop.  If by chance that fails
(e.g. /usr/spool/mail is full or missing or something), I also try just
storing it in my inbox.  By looking at the sendmail.cf provided by Sun,
I figured out that the undocumented -d switch to /usr/bin/mail causes
it to deliver mail into the user's mailbox.  There must be a similar
mechanism on your system.  Just find it and use it.

Oh, one other thing:  My incoming mail is filtered through a script
that deletes the first line (which is the From_ line) before feeding it
to slocal.  This script invokes slocal like this:

   sed 1d < $TMP | $SLOCAL -user dhesi || 
      sed 1d < $TMP | /usr/bin/mail -d dhesi

The || is there in case the pipe to slocal fails for some reason.  In
that case we do a direct delivery to my mailbox, so I don't lose or
bounce mail just because slocal happened to be missing or didn't execute
correctly.  (Our slocal dumps core on very long headers.)
--
Rahul Dhesi <dhesi%cirrusl@oliveb.ATC.olivetti.com>
UUCP:  oliveb!cirrusl!dhesi
A pointer is not an address.  It is a way of finding an address. -- me