HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Configure the email server

Explains how to configure an email SMTP server to work with Optimizely Digital Experience Platform (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.

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

📘

Note

If you want to explore more use cases beyond using DXP as an SMTP server, for example using custom HTML templates in SendGrid, you will need to subscribe to your own SendGrid account (or another SMTP provider).

Email service account

To get an SMTP user setup, go to the DXP project in the management portal. Under the API tab 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. Save it after generating a new key because you can see it only directly after creation.

generate an API key for SendGrid

Add the SMTP email configuration

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

{
  "EPiServer": {
    "Cms": {
      "Smtp": {
        "DeliveryMethod": "Network",
        "SpecifiedPickupDirectory": {
          "PickupDirectoryLocation": "./MailDrop"
        },
        "Network": {
          "Host": "smtp.sendgrid.net",
          "Port": "587",
          "UserName": "apikey",
          "Password": "API key generated in management portal"
        }
      },
      "Notification": {
        "NotificationEmailDisplayName": "Test Content Approval",
        "NotificationEmailAddress": "[email protected]"
      }
    }
  }
}
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 = false,
        Port = 587,
        Host = "smtp.sendgrid.net"
    };
  });
}

DNS configuration

To send emails from a custom domain, you should configure a Sender Policy Framework (SPF), a type of Domain Name Service (DNS) record that identifies mail servers permitted to send emails on behalf of your domain. Contact Optimizely with the sending domain to assist you with configuration and activating Sender Authentication

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 entrydomain.com TXT v=spf1 include:sendgrid.net -all
  • Multiple entriesdomain.com TXT v=spf1 include:sendgrid.net include:spf.protection.outlook.com -all