Email Service Providers

v 10.0.0

Email Service Providers

The actual work of dispatching/sending an email is performed by an Email Service Provider (implements IEmailServiceProvider). The core consists of two providers at the moment:

  • SMTP - Used to send emails via SMTP servers
  • SMTP Pickup Directory - Can be used during development/testing to place e-mails in a folder on the development/test-computer.

We also provide some open source implementations of providers that you can use in your project or use as a reference for your own custom implementations:

The Email Service Provider needs to be configured in the Administration-section for each Workspace.

Custom Email Service Provider

public class CoolEmailCompanyEmailServiceProvider : IEmailServiceProvider
{
    public string Alias => "coolEmail";
    public string DisplayName => "Cool Email";
    public string SettingsView => "~/App_Plugins/coolEmail/settings.html";
    public Dictionary<string, object> Settings { get; set; }
    
    public SendOutConfiguration GetSendOutConfiguration()
    {
        throw new NotImplementedException();
    }

    public ValidationErrorCollection ValidateSettings(Dictionary<string, object> settings)
    {
        throw new NotImplementedException();
    }

    public void Send(List<SendEmailJob> batch)
    {
        throw new NotImplementedException();
    }

    public CommandResult Send(MailMessage message)
    {
        throw new NotImplementedException();
    }
}

Adding the Email Service Provider to our list of services, in your startup code:

public class MySiteComposer : IComposer {
    public void Compose(IUmbracoBuilder builder)
    {
        builder.NewsletterStudio().EmailServiceProviders.Append<CoolEmailCompanyEmailServiceProvider>();
    }
}

Then, in the Workspace administration, the new provider should show up here:

Configure custom provider