are you sure you want ot give apache user read access to your email directories?
What would happen if someone found a way to "confuse" your script? They'd be able to read everyone's mail.
What are you trying to do? A webmail frontend? Try
http://www.squirrelmail.org/ .