Applies to versions: Latest
Other versions:

Configuring the email server

Recommended reading 

This topic explains how to configure an email SMTP server to work with Optimizely DXP. For Optimizely to send out email notifications, configure your email server with a server endpoint that is reachable from the site, and can send emails using a specified from-address. 

How it works

DXP provides access to a cloud-based email service for automated sending of transactional emails for website communication. This configuration is not automatically applied by Optimizely through the standard configuration transforms, so add this manually.

Email service account

To get an SMTP user setup, go to the DXP project in the management portal. Under the API tab, there is an option to generate an API key for SendGrid. This API key, together with username and hostname, should be used to populate the <smtp> section in web.config; see the Adding the SMTP email configuration section. After generating a new key, save it because you can see it only directly after creation.


Adding the SMTP email configuration

Add the following section to the web.config of your website; userName and Password is generated through the management portal. See also:  Authentication (SendGrid article).

"EPiServer": {
  "CMS": {
    "SmtpOptions": {
      "DeliveryMethod"            : "Network",
      "SpecifiedPickupDirectory"  : {
        "PickupDirectoryLocation" : "./MailDrop" 
      "network": {
        "host"     : "smtp.sendgrid.net", 
        "port"     : "587",
        "userName" : "apikey",
        "password" : "API key generated in management portal"
    "NotificationOptions": {
      "NotificationEmailDisplayName" : "Test Content Approval", 
      "NotificationEmailAddress"     : "cms@ep.qa" 
public void ConfigureServices(IServiceCollection services)
  services.Configure<SmtpOptions>(x =>
      x.DeliveryMethod = "Network",
      x.Network = new Network
          UserName = "apiKey",
          Password = "API key generated in management portal",
          UseSsl = true,
          Port = 587,
          Host = "smtp.sendgrid.net"

DNS configuration

To send emails from a custom domain, you should configure a Sender Policy Framework (SPF), which is a type of Domain Name Service (DNS) record that identifies mail servers that are permitted to send emails on behalf of your domain. Optimizely will advise on the correct configuration for this.

If you want to use SendGrid to send mail from your domain, add an SPF record to your  DNS zones as shown in the following examples.

Single entry

domain.com TXT v=spf1 include:sendgrid.net -all

Multiple entries

domain.com TXT v=spf1 include:sendgrid.net include:spf.protection.outlook.com -all
Do you find this information helpful? Please log in to provide feedback.

Last updated: Sep 28, 2021

Recommended reading