Create the MTM for SMS(KUidMsgTypeSMS), switch to the required entry. Cast the MTM to the CSmsClientMtm class and call the RestoreServiceAndSettingsL() function, then get the SMS header using the SmsHeader() function. The SMS header contains the sender address. You can retrieve it using the FromAddress() function.
To use the CSmsClientMtm and the CSmsHeader classes include the smsclnt.h and the smuthdr.h files.
msvEntry.iDetails contains the name of the message. It might be the phonenumber but if there is a ContactCard for it, "iDetails" contains the name of the card. Is there a way to get the phonenumber?