zsh-users
 help / color / mirror / code / Atom feed
* Re: 2nd mail question :)
@ 2001-07-03 14:55 William H. Magill
  0 siblings, 0 replies; 3+ messages in thread
From: William H. Magill @ 2001-07-03 14:55 UTC (permalink / raw)
  To: gt4556a; +Cc: zsh-users

>   Date: Tue, 26 Jun 2001 23:34:35 -0400
>   From: =?iso-8859-1?Q?J=F6rg_Ziefle?= <gt4556a@prism.gatech.edu>
>
>   Does anybody see a way to execute an external program when new mail has
>   come in?  Events, for example?
>
>   What I wanna do is when new mail arrives, I want to have a little
>   program executed that starts my mailer with the right folder
>   (user-specified if several folders have received mail).
>
What you need is "procmail." It does exactly what you want, plus lots more.

It is a mail filter or local delivery agent. 

You can sort mail via a .procmailrc into all kinds of incoming mail boxes,
run programs on them, etc.

-- 
                        www.tru64unix.compaq.com
                              www.tru64.org
                             comp.unix.tru64
                        
T.T.F.N.
William H. Magill                          Senior Systems Administrator
Information Services and Computing (ISC)   University of Pennsylvania
Internet: magill@isc.upenn.edu             magill@acm.org
http://www.isc-net.upenn.edu/~magill/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: 2nd mail question :)
  2001-06-27  3:34 Jörg Ziefle
@ 2001-06-27  7:28 ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2001-06-27  7:28 UTC (permalink / raw)
  To: Jörg Ziefle, zsh-users

On Jun 26, 11:34pm, Jörg Ziefle wrote:
} Subject: 2nd mail question :)
}
} Does anybody see a way to execute an external program when new mail has
} come in?  Events, for example?

It's not really documented, but you can put any $-expansion you like in
the notification message in mailpath.  E.g.:

    mailpath=( $HOME/Mail'?New mail in $_ at $(date)' )

} What I wanna do is when new mail arrives, I want to have a little
} program executed that starts my mailer with the right folder
} (user-specified if several folders have received mail).

Hrm.  Why not just leave your mailer running and let it do the new mail
checking?  (Secondary question, why not get a better mailer?)

The thing to remember about stuff in $(...) is that zsh wants to read
the output from it -- so zsh will wait not just until the program exits,
but until it actually reads end-of-file, which means even putting the
program in the background won't necessarily unblock zsh.  At the same
time, the program's output (and maybe input) are directed away from the
terminal, so unless you explicitly point them back you can't interact
with the program.

So if you really want zsh to automatically fire up some kind of mail
client when new mail arrives, you need something like:

    mailpath=( $HOME/Mail'?$(mutt -f "$_" </dev/tty >&/dev/tty)' )

Note placement of single vs. double quotes.  Note also that zsh will run
this once for every file that has new mail.  A better solution might be
something like this:

    mailpath=( $HOME/Mail'?$(echo "$_" >>| ~/.newmail) )
    precmd() {
	if [[ -f ~/.newmail ]]; then
	    # There'll be one line for each mailbox.
	    # Run your mailer appropriately.
	    mutt -f "$(head -1 ~/.newmail)" # or whatever
	    rm ~/.newmail
	fi
    }

I predict, however, that after at most a day of having your mail client
repeatedly pop open in the middle of whatever else you're doing, you will
abandon this idea.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   

^ permalink raw reply	[flat|nested] 3+ messages in thread

* 2nd mail question :)
@ 2001-06-27  3:34 Jörg Ziefle
  2001-06-27  7:28 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Jörg Ziefle @ 2001-06-27  3:34 UTC (permalink / raw)
  To: zsh-users

Does anybody see a way to execute an external program when new mail has
come in?  Events, for example?

What I wanna do is when new mail arrives, I want to have a little
program executed that starts my mailer with the right folder
(user-specified if several folders have received mail).

Thanks,

Jörg


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-07-03 14:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-03 14:55 2nd mail question :) William H. Magill
  -- strict thread matches above, loose matches on Subject: below --
2001-06-27  3:34 Jörg Ziefle
2001-06-27  7:28 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).