Thunderbird: new email notification not working properly

thunderbird

I have set up "new email notification" in my Thunderbird, both "Show an alert" and "Play a sound", as shown below. But now I am experiencing strange problems.

The sound only works sometimes. Then, I close Thunderbird and start again, and there is 50% chance that the sound will not work. If I keep restarting Thunderbird, eventually the sound will start to work again.

The wav file exists, when I click on Play I can hear the sound.

enter image description here

I have a suspicion, this problem might be connected to the fact, that I have two Thunderbird Profiles which I am using simultaneously. Sometimes the Notification works in both, sometimes in one only. The problem is with both the sound notification and the "Show an Alert" notification.

I use following commands to start the two profiles, respectively:

icedove -P "default"
icedove -P "second" -no-remote

The problem with the notification happens in a non-deterministic way. Even when only one profile is running, the notifications might not work (thus, the problem is not caused by one instance "blocking" the device/resource).

How could I fix this problem?
New mail notifications are crucial for my workflow. This problem is critical for me.

I am using Thunderbird (Icedove) 24.6.0

UPDATE:

I did some further troubleshooting: When I am monitoring access to the wav file using inotify, I see that upon new message, no process is attempting to open new_mail.wav:

while inotifywait new_mail.wav ; do echo "$(date +%T) inotify event" ; done

When I click on the Play button however, the sound actually plays, I and get the inotify events as well.

This looks like some bug in Thunderbird, where an event (new email) is not properly recognized and acted upon.

Best Answer

This is an alternative solution to play the sound file and show a notification on the desktop.

Create a small shell script that will contain the commands to be run when a new email arrives:

#!/bin/sh

if [ $1 = true ]; then
    aplay new_mail.wav
    notify-send --icon=icedove Icedove 'There are new emails!'
fi

Save the script and make it executable:

chmod +x /path/to/script.sh

Install the extension FireTray, then go to its settings. On the tab Mail, place the full path to the script in Launch on count change.

Some notes:

  • The script will be called by FireTray either with the argument true or false. The argument will be true if there's new mail.
  • aplay comes from the package alsa-utils, and should be installed by default. If you use PulseAudio, you can use paplay instead, from the package pulseaudio-utils, but aplay is supposed to work with PulseAudio too.
  • notify-send needs the package libnotify-bin.
Related Question