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:
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.
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: