Hi
Your are using email dataconnection using data adapter.Data adapter is an object and 'To' is the property of this object which we need to add in the code
You have wrtten this code line as
objEmail = XDocument.DOM.selectSingleNode ("//my:ToField").text;
in the above code line should be written as
objEmail.To = XDocument.DOM.selectSingleNode ("//my:ToField").text;
similarly for subject
objEmail.Subject = XDocument.DOM.selectSingleNode ("//my:SubjectField").text;
Look at the following link
http://www.infopathdev.com/forums/topic.asp?TOPIC_ID=2583
Madhuri
http://www.ggktech.com