Hi,
Here is the code which you want in script:
var oEmail = XDocument.DataAdapters("Email Submit");
oEmail.To =
[email protected];
oEmail.CC =
[email protected];
oEmail.Subject = XDocument.DOM.selectSingleNode("xpath of the text box which you want to use");
oEmail.Intro = "Email body";
oEmail.Submit();
In the above code "Email Submit" is the data connection which is used to submit the emails.
You can create this in InfoPath form from Tools->Dataconnections.