I dont know any pre-written scripts but its simple enough to code one yourself. All you need is a table in your DB with a row for each message containing the message text, message sender, message recipient, date sent and optionally, columns saying whether the message has been read or replied to.
A script should also be regularly run to delete any messages that are over x number of days old.