In this tutorial, you will learn how to set up and configure SMTP within a Sitecore CMS-powered website so that you can send emails from Sitecore. There are several ways of sending emails within Sitecore. If you want to learn about the different options available to you and learn when you should use each approach, read on 🔥🔥🔥

Webforms For Marketers

Webforms For Marketers (WFFM) is probably the most commonly used Sitecore module. WFFM allows non-technical people to create forms that site visitors can fill out. The end action of a completed form might be for the site visitor to be sent an email with a link to a downloadable white paper. If you want to send emails from your WFFM forms you will need to enable SMTP within the WFFM configuration area. To enable this, open the Sitecore content editor:

How To Configure Smtp Details In Sitecore

To configure WFFM, navigate to:

SitecoreSystemModulesWeb Forms for MarketersSettingsActionsSave ActionsSend Email Message

In the Submit section, you should see a text area called Paramaters. It's in this section you define the SMTP details:

Most SMTP gateways will require a username and a password for authentication. You can add a username and password within WFFM, using these tags:

You can also specify SSL using this setting:

One word of caution, although the setting is for SSL, WFFM actually uses TLS in the back-end. If you have no idea about the difference between SSL and TLS, I would recommend reading this. To configure WFFM to send secure emails, you need to set the port to 587 and not the default SSL port of 465. After making your changes do not forget to click on the Save button in the top ribbon. With this setting enabled, all forms that have been configured to send email messages on submit should now work 💥

Default Smtp Settings

Sitecore also has a global Smtp setting. Sitecore uses the details added within the global SMTP provider for generating emails like the content editors password recovery, or the content editor workflow notification emails. To enable these types of email, open up your solutions web.config file. Here you should be able to find a section like the one below:

Configuring SMTP within web.config should be pretty straightforward. Fill in the details and emails triggered via Sitecore itself, should now work 💥. If you want to enable SSL for your default Sitecore emails, you can do this the normal ASP.NET Framework way. In your web.config file, you can add the following configuration:

To send an email manually using these settings, you can use the following code using the Sitecore.MainUtil.SendMail:

You are now a master on how to send emails through Sitecore 🔥🔥🔥. If you use WFFM you need to add specific config to make it send emails. For all other emails web.config is your best buddy 😊. There are a few surprises when enabling emails in Sitrecore, howevver, by and large, it is pretty straight forward. Happy Coding 🤘