Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Infopath-Sharepoint-Email and Submit

Status
Not open for further replies.

cudofcow

Technical User
Mar 4, 2010
2
US
I've created an infopath 2007 browser enabled form. When the user clicks Submit, it sends out an email. For some reason it doesnt send any data to the form library. If i dont use the email option it sends over all the data. So is there a way to get both? Send Email and Submit data to the Form library?
 
Hi,

You can set the action for the Submit button as Rules and Custom code and paste the following in the Submit_clicked event.

System.Text.StringBuilder message = new System.Text.StringBuilder();
message.AppendLine("Your Mail content here");

System.Collections.Specialized.StringDictionary messageHeader = new System.Collections.Specialized.StringDictionary();

messageHeader.Add("to", "ToEmail");
messageHeader.Add("from", "FromEmail");
messageHeader.Add("subject", "Subject");
messageHeader.Add("content-type", "text/plain");

Microsoft.SharePoint.Utilities.SPUtility.SendEmail(
SPContext.Current.Web, messageHeader, message.ToString());


This will send your email regardless of the other submit actions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top