Side-comment,
I think a better way is to (ab)use the local delivery agent for this, wich usually is called 'procmail'.
In short, this would give you a system that does not check the account constantly, the script executes once it gets an e-mail. This will probably save you as much hazzle as it will save you system resources.
For example, create a ~/.procmailrc file that looks like;
#-- begin --
:0:
* From: some@address.com
{
| cd && ./someScript.pl | ./nextScript.pl
}
#-- end --
When an e-mail arrives, it's sent directly (with attachments, body and all) via STDIN to ~/someScript.pl (and then pipe STDOUT to STDIN on nextScript.pl).
Of course you can use a PHP script, C-program or whatever you want. Perl is quite elegant with the MIME-tools package (www.cpan.org), though. 🙂