As far as I can tell you'd need to work out how to connect to the device first and then send a request to grab the SMS.
If you were only coding it to have a program that does what you need, look at MyPhoneExplorer (
http://www.fjsoft.at/en/) - this does something similar to what you're after.
Coding wise, this link is for Nokia phones only, but may give some inspiration:
http://www.andreavb.com/forum/news/viewtopic_5824.html