This can be done by using a tool called ixbiff which is Linux specific. You can download it from the official website. The installation is quite straightforward and the only configuration required is to define the mailbox to monitor and which LED to assign it to when a new e-mail arrives. The configuration file is /etc/ixbiff.conf. Since a standard keyboard has 3 LEDs, it is only trivial that you can only monitor three mailboxes at the same time.
So let's assume that there are three Linux users in a machine: user1, user2, and user3. If each user has a mailbox defined in /var/mail, then /etc/ixbiff.conf can be defined as follows:
# Blink Num Lock when user1 has new mail led1 = /var/mail/user1 # Blink Caps Lock when user2 has new mail led2 = /var/mail/user2 # Blink Scroll Lock when user3 has new mail led3 = /var/mail/user3
Similarly, one can assign one single LED for all mailboxes by using the following configuration:
# Blink Num Lock when any mailbox has new mail led1 = /var/mail/