Shell script to go out and leech image from email?

We upload all our photos to a MySQL database hosted on Dreamhost through a web front-end.

My wife has a new camera phone that can automatically email the taken photo to a specified email address.

Here’s what I want to do:

Write a shell script that will periodically (cron) run on my dreamhost account (debian/linux) to check the specified email address for new messages/photos, strip out the attached image, and send it off to the MySQL database.

I can use the same PHP script that the web front-end uses to actually load the binary into the mysql table, but I need help with the shell script.

Can anyone point me in the right direction as to command-line tools that might aid in this process? I don’t want to reinvent the wheel – I’ve been looking at “fetchmail”