You can't access these on a standard, non-jailbroken iPhone.
It is only possible when the phone is Jailbreaked. Once Jailbreaked, an application can open the SQLite database at
/var/mobile/Library/SMS/sms.db and read the message table.
It contains, the date/time at which the message was received, the sender/recipient phone number and even the clear text of the message.
However this kind of app won't pass apple appstore approval process.