Subject: pine/procmail alert

From: [email-masked] (Jody Klymak)
Date: 22 Aug 1994 23:46:26 GMT

Hi,

I've got procmail set up to send my mail into four or five
directories.  I have configured my .pinerc so that these directories
are known to pine as incoming-folders.  This all works fine.

The problem now is that when I am notified of new mail, I have to
look through five folders to see where it is!  

Is there any way to get pine to say which incloming-folder has new mail?  
Or is there any way to configure my .procmailrc so that it sends a
message of the sort
	New mail in folder foo!
Any help or ideas would be appreciated.

Thanks,

Jody

[email-masked]

---

From: Dion Vansevenant <[email-masked]>
Date: Tue, 23 Aug 1994 20:17:25 -0400 (EDT)

> directories.  I have configured my .pinerc so that these directories
[...]
> Any help or ideas would be appreciated.

There's a couple of ways actually. I found an environment variable that 
can be set to check specific paths for mail and display custom messages 
if mail is found. It's not very reliable (I think), but it does seem to 
work. Plus it may be only for the DG, I don't know. I'll include my 
.profile so that you can look at it.

Also, as this has been a hot topic for the past week, another respondent 
to someone else's request included a couple of files he wrote to do the 
checking. I'll attach those files as well. I don't know if, or how well 
they work as I haven't had a chance  to try them, but at least you can 
try them out yourself.

Good luck!

Dion

*----------------------------------------------*
| Dion Vansevenant        [email-masked]        |
| Systems Administrator                        |
| Faxon/SMS Canada Ltd.   (519) 472-1006 voice |
| P.O. Box 2382           (519) 472-1072 fax   |
| London, ON                                   | 
| Canada N6A 5A7                               |
*----------------------------------------------*

If you don't change your direction - you're bound to end up where you're headed.
                                                               - Chinese Proverb

#	<@(#) stdprofile,v	5.1.1.1>
#	This is the default standard profile provided to a user.
#	They are expected to edit it to meet their own needs.

MAIL=/usr/mail/${LOGNAME:?}
PATH=/usr/bin

#
# if symbolic link to X11 binaries exists, then include it in the path
#
if [ -d /usr/bin/X11 ]
then
    PATH=$PATH:/usr/bin/X11
    export PATH
fi

#
# Anything below this point is something that I have added.
#
FILTER=$HOME/Mail/Incoming
MAILPATH=/usr/mail/${LOGNAME:?}%'You have mail in INBOX':\
$FILTER/Pine%'You have mail in Pine':\
$FILTER/Faxon%'You have mail in Faxon':\
$FILTER/Gopher%'You have mail in Gopher':\
$FILTER/Majordomo%'You have mail in Majordomo':\
$FILTER/Major.Faxon%'You have mail in Major.Faxon':\
$FILTER/Procmail%'You have mail in Procmail'
export MAILPATH
PATH=$HOME:$HOME/bin:/usr/gopher/bin:/usr/gopher/etc:/usr/local/archie:$PATH
export PATH
echo ''
# read termtype
TERM=`ckkeywd -d vt100 -Q -p "Enter your term type" vt100 wy50 vp60`;export TERM
stty erase `tput kbs` kill \^u intr \^c
echo Hello `logname`
set nohup
MORE='-f';export MORE
PAGER=more; export PAGER
NNTPSERVER=news.u.washington.edu;export NNTPSERVER

.TH 1L "mailcheck" "6-11-1994" "U. of Evansville"
.SH NAME
mailcheck - Checks multiple folders for unread mail
.SH SYNOPSIS
.B mailcheck
.br
.SH DESCRIPTION
.I mailcheck
checks user specified mail folders for the presence of unread mail.
Unread mail does not necessarily indicate new mail. 
.I mailcheck
was designed to work with
.I pine
and is not guaranteed to work with any other mail user agent.

.I mailcheck
expects that the file
.I .mailcheck
resides in the user's home directory and contains
the name of mail folders that should be checked.  The folder names
are one to a line.  If the name of the folder does not contain
the full path (eg, /usr/spool/mail/heck), the user's home directory
will be prepended to the name of the folder (eg, Mail/stuff
will cause ~/Mail/stuff to be checked).  
.SH FILES
~/.mailcheck
.SH AUTHOR
Patrick Heck, University of Evansville
.SH SEE\ ALSO
 pine(1)
 procmail(1)
.SH BUGS
Does not understand ~/ notation.  Will not work with more than 20 folders.
Will not work when complete path to folder is more than 50 characters.
All bugs due to the quick-and-dirty nature of this program (ie, I needed
it done in 30 minutes and it took me 45 as it is).
.SH BUG REPORTS TO
[email-masked]
.SH COPYRIGHTS
.ps 18
\fB\(co\fR\s12 Ain't no stinkin' copyright

#include <stdio.h>
#include <string.h>
#include <pwd.h>

#define TRUE   1
#define FALSE  0

FILE *fp_curfolder;    /* current mail folder being checked */
FILE *fp_mailcheck;

char logname[100];
struct passwd *pwentry;

int main(int argc, char **argv)
{
    char logname[15];
    int i;
    int num_unread_folders = -1;
    char folder[20][50];
    char orig_name[1000];
    char curfolder[1000];
    char mailcheck[1000];      
    char line[1000];

    if (cuserid(logname)==NULL) {
	fprintf(stderr,"%s: Can't determine who you are.",argv[0]);
	return 1;
    }
    if ((pwentry=getpwnam(logname))==NULL) {
	fprintf(stderr,"%s: Can't access /etc/passwd information.",argv[0]);
	return 1;
    }

    /** create file name for .mailcheck */
    strcat(strcpy(mailcheck,pwentry->pw_dir),"/.mailcheck");
    if ((fp_mailcheck = fopen(mailcheck,"r"))==NULL) {
	fprintf(stderr,"%s: Unable to access '.mailcheck' file.\n",argv[0]);
	return 1;
    }

    while (!feof(fp_mailcheck))
    {
	curfolder[0] = '\0';
	fgets(curfolder, 100, fp_mailcheck);
	if (curfolder[0] == '\0')
	    continue;
	/* get rid of newline character (if exists) */
	for (i=0; curfolder[i] != '\0'; i++)
	{
	    if (curfolder[i] == '\n')
		curfolder[i] = '\0';
	}
	strcpy(orig_name,curfolder);  /* save name for message */
	if (curfolder[0] != '/')  /* then need to prepend home dir */
	{
	    strcpy(line,curfolder);
	    strcat(strcat(strcpy(curfolder,pwentry->pw_dir),"/"),line);
	}
/*	printf("Checking %s\n",curfolder); */
	if ((fp_curfolder = fopen(curfolder,"r")) != NULL)
	{
	    if (unreadmail(fp_curfolder))
	    {
		num_unread_folders++;
		strcpy(folder[num_unread_folders],orig_name);
	    }
	    fclose(fp_curfolder);
	}
    }
    if (num_unread_folders > -1)
    {
	for (i=0; i<=num_unread_folders; i++)
	{
	    printf("Unread mail in %s\n",folder[i]);
	}
    }
}

int unreadmail(FILE *fp_curfolder)
{
    char line[1001];
    while (!feof(fp_curfolder))
    {
	fgets(line, 1000, fp_curfolder);
	if (!strncmp(line,"From ", 5))
	{
/*	    printf("%s",line); */
	    while (1)
	    {
		fgets(line, 1000, fp_curfolder);
/*		printf("%s",line); */
		if (!strcmp(line,"\n"))
		    return TRUE;
		if (!strncmp(line,"Status: R", 9))
		    break;
		if (!strncmp(line,"Status: ", 8))
		    return TRUE;
	    }
	}
    }
    return FALSE;
}

---

From: David L Miller <[email-masked]>
Date: Mon, 22 Aug 1994 16:59:26 -0700 (PDT)

Pine only notifies you of new mail in the INBOX and the currently open
folder, and it does distinguish those. 

|\ |  |\/|  David L. Miller    [email-masked]  (206) 685-6240
|/ |_ |  |  Software Engineer, Pine Development Team   (206) 685-4045 (FAX)
University of Washington, Networks & Distributed Computing, JE-20
4545 15th Ave NE, Seattle WA 98105, USA