Danny | 17 Apr 2012 21:27
Picon

Playing a sound

Hi guys,

Is it possible to play a soundfile when procmail encounters mail from a certain
e-mail address?

Thank You

Danny
Andrew Edelstein | 17 Apr 2012 21:54

Re: Playing a sound

On 04/17/2012 02:27 PM, Danny wrote:
> Is it possible to play a soundfile when procmail encounters mail from a certain
> e-mail address?
That depends on your operating system, is your mailbox server also your 
workstation, etc.
Generally, assuming your workstation is the same machine where Procmail 
is running, this is fairly trivial. You just need the "action" of your 
procmail recipe to include calling your sound player program, presumably 
telling it what sound file to play. You may have to monkey around with 
user/permissions a bit so that the user that's running the procmail 
script has permission to access your sound device. Presumably if 
procmail is being run as you, and you are logged into X windows, this is 
a non-issue as you will have permission to access the sound device.

--

-- 
Andrew Edelstein - andrew <at> pure-chaos.com
https://andrew.pure-chaos.com/
Danny | 17 Apr 2012 22:02
Picon

Re: Playing a sound

Hi,

I am running Debian ... I think I know how to do it now ...

Thank You

Danny

>On Apr 17 12, Andrew Edelstein :
> To: procmail <at> lists.RWTH-Aachen.de
> Date: Tue, 17 Apr 2012 14:54:42 -0500
> From: Andrew Edelstein <andrew <at> pure-chaos.com>
> Subject: Re: Playing a sound
> User-Agent: Mozilla/5.0 (X11; Linux i686; rv:11.0) Gecko/20120329
> 	Thunderbird/11.0.1
> X-BeenThere: procmail <at> lists.RWTH-Aachen.de
> 
> On 04/17/2012 02:27 PM, Danny wrote:
>> Is it possible to play a soundfile when procmail encounters mail from a certain
>> e-mail address?
> That depends on your operating system, is your mailbox server also your  
> workstation, etc.
> Generally, assuming your workstation is the same machine where Procmail  
> is running, this is fairly trivial. You just need the "action" of your  
> procmail recipe to include calling your sound player program, presumably  
> telling it what sound file to play. You may have to monkey around with  
> user/permissions a bit so that the user that's running the procmail  
> script has permission to access your sound device. Presumably if  
> procmail is being run as you, and you are logged into X windows, this is  
> a non-issue as you will have permission to access the sound device.
(Continue reading)

Re: Playing a sound

At 12:27 2012-04-17, Danny wrote:
>Hi guys,
>
>Is it possible to play a soundfile when procmail encounters mail 
>from a certain
>e-mail address?

:0
* ^From:.*\<some_address <at> domain\.tld
{
         # c - make a copy for purpose of invoking a sound processor
         # i - ignore write errors (say, because your invoked program doesn't
         # give a hoot about stuff on stdin)
         :0ci
         | path/to/some/sound/player soundfile

         # original processing continues here (say you want to file it special
}

The \< isn't literal open bracket, it's regexp for "character before 
or after a word, and of course, the above could be simplified to more 
specifically what you asked for:

# this doesn't copy the message, so it effectively gets tosssed when invoking
# the sound player.
:0i
* ^From:.*\<some_address <at> domain\.tld
| path/to/some/sound/player soundfile

YOU need to find a suitable audio player.  It's an exercise for you 
(Continue reading)

Robert Bonomi | 18 Apr 2012 05:45

Re: Playing a sound

`
> Date: Tue, 17 Apr 2012 21:27:32 +0200
> From: Danny <dannydebont <at> gmail.com>
> Subject: Playing a sound
>
> Hi guys,
>
> Is it possible to play a soundfile when procmail encounters mail from a certain
> e-mail address?

Yes, procmail is -capable- of doing it.  To wit;

    :0 c:
    * ^From:.*${ADDRESS}
    | ${PLAYSOUND}

However _system_ restrictions may prohibit it.  e.g. system-enforced access
controls may allow only the user logged in on the 'console' to access the
audio device.

More than two decades ago, in a _production_ business environment, I 
deployed a routine on user workstations that submitted a job to a remote 
mainframe.  when the 'completion status' mail came back one of two sound-
effects would play, depending on whether the job completed sucessfully or
failed.  Picked from the 'standard' samples that came with the O/S release,
they were a 'gong' for a successful run, and a 'toilet flushing' for the
other case.   One day, a new user got the submitted data wrong for something
like 20 consecutive attempts.  When he -finally- got the 'gong', he got a
round of applause from everybody within earshot.  *GRIN*
(Continue reading)

LuKreme | 18 Apr 2012 06:34
Favicon

Re: Playing a sound

Danny squawked out on Tuesday 17-Apr-2012 <at> 13:27:32
> Hi guys,
> 
> Is it possible to play a soundfile when procmail encounters mail from a certain
> e-mail address?

Yep, it's quite easy. On the tried period of time that I was running postfix/procmail on my OIS System I had a
recipe that looked something like this on my personal account. I set UNAME by indexing the CLEANFROM
against a whitelist local file.

user <at> domain.tld Fred Smith

# This is a non-delivery recipe
:0
* CLEANFROM ?? $UNAME
{ DUMMY=`/usr/bin/say "New mail has arrived from $UNAME" -v Alex -r 255` }

Of course, the command that you use will vary by OS, but it really is that simple. The hard part was building
UNAME, which I did with a local file that I edited manually when I wanted notifications from a person.

But the experiment of running postfix and procmail on OS X was short-lived, and my servers are miles away, so
sound playing would be rather silly at this point.

You can do pretty much anything you want in a recipe, and executing it from a fake variable assignment avoids
a lot of issues.

--

-- 
I DO NOT HAVE DIPLOMATIC IMMUNITY Bart chalkboard Ep. 9F20
Alan Clifford | 18 Apr 2012 19:25
Favicon

Re: Playing a sound

Danny wrote (at 21:27 (+0200) on Tuesday, 17th April, 2012):

> Hi guys,
>
> Is it possible to play a soundfile when procmail encounters mail from a certain
> e-mail address?
>
> Thank You
>
> Danny

I remember trying this and I still have the recipe commented out in my 
procmail files:

FROMHEADER=`formail -c -rtz -x To:`
# play sound
# DUMMY=`test -f "${PMDIR}/mailsounds/${FROMHEADER}.wav" \
# && play "${PMDIR}/mailsounds/${FROMHEADER}.wav" > /dev/null &`

I had a directory with sounds:

alan <at> malander:~$ ls ~/.procmail/mailsounds/
alanclifford\ <at> gmail.com.wav  test2\ <at> clifford.ac.wav  test\ <at> clifford.ac.wav

I don't sit at that computer any more since I got a laptop.

Alan

(  Please address personal email to alan+1 <at>  as email to lists <at> 
    is only read from my subscribed lists. )
(Continue reading)

Danny | 18 Apr 2012 19:46
Picon

Re: Playing a sound

Thank you all guys ... appreciated ... I now know more or less what to do ...

Danny

>On Apr 17 12, Danny :
> To: procmail <at> lists.RWTH-Aachen.de
> Date: Tue, 17 Apr 2012 21:27:32 +0200
> From: Danny <dannydebont <at> gmail.com>
> Subject: Playing a sound
> User-Agent: Mutt/1.5.18 (2008-05-17)
> 
> Hi guys,
> 
> Is it possible to play a soundfile when procmail encounters mail from a certain
> e-mail address?
> 
> Thank You
> 
> Danny

Gmane