Actually giving yourself a project is a great way of learning a language. Do you know mysql at all because at first I would say use that, but if you don't you could just do it with a text file.
You'll have to decide on what data is stored for the messages like name, date, subject and the message body, and then decide how these will be broken into threads, so a key for each message will be needed and another table linking all the messages into threads, or have a thread id in the message table.
Actually I'll shut up because you'll find something far better than all my off the cuff jibbering.