New Mail Count Notification to a cell phone using Perl and IMAP

At times, I may be away from my computer. It is at these times that I sometimes wish to know how many new messages are sitting in my inbox. Nothing fancy, just a simple email that goes to my cell phone an gives me a new message count.

I looked around, saw a couple scripts that dealed with POP3 accounts, but nothing that deals with IMAP. So, I wrote a script that works with IMAP.

Please keep in mind that this script is very basic; it doesn't tell you who the new email is from or anything like that. Basically, this is my rough cut starting point for more advanced ideas.


  • Perl 5.x and above
  • Net::IMAP::Simple
  • Mail::Sendmail


Feel free to make changes and additions; I'm open to suggestions and fixes. Released under the GPL License. Use at your own risk!

Download - (Shift-Click to download, or copy and paste to a new file)


1. Install the script somewhere that you'll remember.

2. Edit the variables at the top of the script. You must set these to you specific setup!

3. Run it from the command line (i.e. "perl mail_notify" without qoutes) to make sure you don't receive any errors.

4. If it runs fine, setup a cron job to run at whatever interval you like.