Skip to content

KayeeNL/Sitecore.ExperienceForms.Modules.SendMail

Repository files navigation

README

This brings a new Send E-mail Action for Sitecore 9 Forms, enabling the submission of e-mails using MainUtil.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 last packages from https://bitbucket.org/nishtechinc/formssendmail/src/7e943104a21f3d04500ac3713af894ca53da3f57/Sitecore%20Packages/?at=master 2. Package 1 - Sitecore 9 Forms - Send Email Action-1.x.zip - All files and items needed for the Send E-mail Action 3. Package 2 - Sitecore 9 Forms - Test Send Email Form-1.x.zip - Test Send E-mail Form for quick testing the form
  2. Install Package 1 to have the Action installed
  3. (Optional) Install Package 2 to have the Test Send-Email Form
  4. Setup your SMTP server by editing /App_Config/Include/smtp.config and modify it to your SMTP server. Default values will use localhost a port 25, which is good for development with a tool such as SMTP4DEV (https://archive.codeplex.com/?p=smtp4dev)
  5. Publish + Reindex

Configurations

Step by Step

  • Create an E-mail Templates under /sitecore/system/Settings/Forms/E-mail Templates
  • Fill up fields Subject, From, To, Cc, Bcc and either Message RichText or Message Text
  • 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
  • Add your form to a Page using the MVC Form Component
  • 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.

E-mail Templates

Dictionary Items

Dictionary items used at this Action are stored under the Default Global Dictionary of Sitecore, at path /sitecore/system/Dictionary/Forms/Actions/SendMail. You can move these Dictionary Entries to any other Dictionary if you want, and also modify their Texts, just make sure you don't change their Keys so the code can find them.

Test Send Email Form

If you installed the second package and want to use the Test Send E-mail Form, make sure to add an MVC Form Rendering (/sitecore/layout/Renderings/System/Forms/Mvc Form) to a placeholder in a page. After that, you can Preview the item with the Test Form and submit to have the E-mail message being sent.

Debug

  • If anything goes wrong the Exception will be logged to Sitecore log files with the following pattern:
    • [SendMail Action] Error sending e-mail based on template {ID}

Implementation

Please check this article (yet to come) for details on the implementation.

What is this repository for?

Who do I talk to?