Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 04-10-2004, 06:16 PM   #1
LQ Newbie
Registered: Sep 2003
Distribution: Red Hat 9
Posts: 6

Rep: Reputation: 0
Perl Script from Karamba Play a wav when new mail arrives

I want to edit this code to play a wav file when new mail arrives

use Net::POP3;

my $ServerName = $ARGV[0];

# If your username contains a @ character you
# must replace it with \@
my $UserName = $ARGV[1];
my $Password = $ARGV[2];
my $pop3 = Net::POP3->new($ServerName);

if (!$pop3) {
	print "server unreachable";

my $Num_Messages = $pop3->login($UserName, $Password) + 0;

if ( $Num_Messages == 1 ){
   print $Num_Messages ." new\n";
xmms /path to file/whatever.wav; #my addition as you can see it does not work
elsif ( $Num_Messages > 1 ){
    print $Num_Messages ." new\n";
xmms /path to file/whatever.wav; # same here
    print "0 new\n";


Last edited by mamoose; 04-11-2004 at 04:09 PM.
Old 04-10-2004, 06:52 PM   #2
Senior Member
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
exec /path to xmms/xmms /path to file/whatever.wav instead.
Old 04-10-2004, 06:54 PM   #3
LQ Newbie
Registered: Sep 2003
Distribution: Red Hat 9
Posts: 6

Original Poster
Rep: Reputation: 0
Thank you for your response, but I get the same result no sound

Last edited by mamoose; 04-11-2004 at 04:10 PM.
Old 04-23-2004, 04:51 AM   #4
the Bruuu
LQ Newbie
Registered: Apr 2004
Posts: 1

Rep: Reputation: 0
Have you tried to run the xmms command at the prompt?
xmms can give problem for a number of reason including when it doesn't find the file or when the audio driver is not the appropriate...
Old 04-23-2004, 11:29 AM   #5
Registered: Apr 2004
Posts: 101

Rep: Reputation: 15
If you are using kde desktop try killing the artsd process using
killall -9 artsd
then try running your program. Hope this helps
Old 04-24-2004, 04:40 AM   #6
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
If you are going to use a plain wav file, Id just cat the wav to /dev/dsp instead of using xmms. That way you dont have xmms popping up everytime you get mail.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
headers displayed when new mail arrives while logged in... plisken Linux - General 2 07-02-2006 08:45 AM
Can't play any other media than WAV polemon Linux - Newbie 3 06-13-2005 03:34 PM
Couldn't play .wav file! muyu Linux - Software 0 02-28-2004 11:38 AM
Play a wav sound when you login Fr3d Linux - General 1 09-06-2003 06:53 PM
wav files play ok but no CD music Rutnut Linux - Newbie 2 12-20-2000 08:45 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:37 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration