Send E-mail Action in Sitecore Forms

Introduction : 

 This brings a new Send E-mail Action for Sitecore 9 Forms, enabling the submission of e-mails using the SendMail method, which will use an SMTP server to submit e-mails in HTML or Plain Text. When a Send E-mail Action is added to a button in a Form, an E-mail Template has to be selected - this is where the E-mail is configured.

 Installation:

 1. Download the package
      Package name - Send Email Action in Sitecore Forms
 2. Install the package in your Sitecore Instance.
 3. Setup your SMTP server in your App_Config/Include/SendEmailAppln.config.
       <add key="EmailServer" value="smtp.gmail.com"/>
       
     <add key="EmailPassword" value=""/>(Enter your password)
 4. Publish + Rebuild the Index.

Configurations:

Step by Step :

1.Open the Email Templates under /Sitecore/system/Settings/Forms/Email Templates/Test E-mail
2. Fill up fields Subject, From, To, Cc, Bcc and Body Content.

Create Form in Sitecore :

1. Go to Sitecore launchpad.
2. Choose Form in Sitecore launchpad.
3. Create a New form with valid FieldName.This field name are used to Email templates.
(Add Keywords using the syntax: {FieldName} in all of these fields to have them being replaced with data typed by the user at the Form.
Add a Send E-mail Action to your form and select the E-mail Template you created.)

Create Page :

1. Create a sample page.
2.Add Layout in the presentation details and also add the control (/sitecore/layout/Renderings/System/Forms/Mvc Form) enter placeholder name(main).
  Choose your form in the data source.
3. After that, you can Preview the item with the Test Form and submit to have the E-mail message being sent.
4. Browse your Form Page, fill the form and submit

If a Send E-mail Action is correctly added to your Form and linked to a valid template, the form will send an e-mail.

Debug

If anything goes wrong the Exception will be logged to Sitecore log files with the following pattern:
[SendMail Action] Error sending e-mail are captured.