This is an application that automatically backs up SMS messages to Gmail and it's still in development and is an open-source code app.

Get more info at the official site: http://code.google.com/p/android-sms/