Send Email In InfoPath Forms SharePoint

InfoPath Forms Services is a Server technology, which makes it possible for people to fill out forms in a Web Browser. Form templates that can be filled out in a Browser are called Browser-enabled form templates. To create this type of form template, you design a Browser-compatible form template in InfoPath, publish it to a Server running InfoPath Forms Services and enable it for use on the Web.

In some cases, you can enable the form template for use on the Web by selecting the Enable this form to be filled out by using a Browser check box in the InfoPath Publishing Wizard. In other cases, you must publish the form template to a shared location on your corporate network and then contact a Server farm administrator for assistance in enabling the form template and making it available on the Server.

Coming to this article, I have two drop-down lists, which contain usernames in them. Hence, when I am clicking submit button, I need to get an E-mail address of the persons selected in the dropdown list.

To get the E-mail address, we will get two methods, which are mentioned below.

  1. Calling user profile Service.
  2. Using user profile list in the site.

For every site, we will have a hidden Sharepoint user info list. For my task, I am using the second approach. Using the second approach, I am passing a username and I am getting a user E-mail. Hence, the process consists of the need to connect to that particular Sharepoint list and open the form in InfoPath form designer. Go to data section and choose data connections.

dataconnections

Subsequently, we will get a pop up dialog, which is shown. 

dataconnections

From the box, shown above, we need to click add button and subsequently pop up the dialog, shown below.

dataconnections

In the next popup Window, we need to select Sharepoint list or library, since we are getting an Email from the user information list of the site.

dataconnections

In the next screen, enter Sharepoint site's URL to get the list data. Afterwards, we need to choose Sharepoint list. The dialog is shown below. 

dataconnections

In the next screen, the list will will display with all the columns. In this list, we need to select a few columns only.

dataconnections

In the second screen, we will get on option. 

Automatically retrieve data when form is opened

This depends on our requirement. You may uncheck also, but when we uncheck, we need to call this method in submit button click event. Give a name to this connection as User information list. Finally, click finish button. Wait  -- our task is not complete. We need to do some work in submit button click event.

The process is shown below.

Go to Button rules and click to create a new rule. In the prompt, shown below, you will find go to run these actions and select Submit data option. It will pop up a dialog and click a new button. In this dialog, we need to select submit data option and click next button. In next dialog, we need to select an E-mail option.

dataconnections

On clicking next button, we will find another dialog in the dialog. Click the function button on 'TO' E-mail address.

dataconnections

When we click, it will open insert formula button. In this dialog, choose insert field or group button and we will get the box, where we will choose advanced view.

dataconnections

In the next Window in fields section, select the connection, which we created just now.

dataconnections

When we select the connection, it will display with the properties and in it, we need to select an Email value in the data field section, which is shown below.

dataconnections

Now, we need to click on filter data to get the Email of a particular person, which is an E-mail,  which we selected in drop-down list. In the next screen, click Add filter button and subsequently, it will popup the Window, as shown below.

dataconnections

We need to do the work in specified work conditions and the screen is shown below.  

dataconnections