Can I build an iOS app which has access to Apple Mail? I would like to build a tool which analyses someone's emails.

Is it possible on iOS or OS X to build something which gets access to emails?
Yes it is possible to get access to a user's e-mails. This assumes the e-mails are stored on a server and the user gives you access. This will be the case for those using IMAP based e-mail accounts and for those using GMail.

You will not easily be able to access e-mails uniquely stored within  Mail.app's stores. See How can I access emails in Apple Mail programmatically?