If you try to pull the whole message into a string, obviously it will exceed PHP memory limits. That is why the File input option exists, so it can process message data in small chunks.
If your message is available via POP3 server, you can pull it using the POP3 class, as it provides a stream wrapper while allows you to access messages as if they were files.
phpclasses.org/package/2-PHP-Access ...
If the message is available only via IMAP protocol, you need to access it with a component that retrieves messages in chunks, rather then whole messages at a time.