Skip to content

Commit

Permalink
Major update to recipient handling
Browse files Browse the repository at this point in the history
Recipient lists are now provider based, and configurable from
web.config. Added new configuration section to make the configuration
easier to read and maintain. Recipient list providers are now the same
for list and jobs. Updated the existing providers to use API controllers
and moved logic to javascript to avoid tricky web forms timing issues.
  • Loading branch information
evest committed Apr 17, 2015
1 parent 3a47eb3 commit eca4c92
Show file tree
Hide file tree
Showing 59 changed files with 2,864 additions and 699 deletions.
54 changes: 50 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,52 @@ If you want to have a plain text version of the newsletter as part of the same e

## Configuration ##
The module supports sending emails through different mail senders (also called a ''sender engine''):

1. Recommended: Mailgun (http://mailgun.com) or SendGrid (http://sendgrid.com)
1. Built-in SMTP support (default)
1. aspnetEmail component from [AdvancedIntellect](http://www.advancedintellect.com/product.aspx?smtp) (license purchase required). **Note!** This sender is not actively supported.
1. aspnetEmail component from [AdvancedIntellect](http://www.advancedintellect.com/product.aspx?smtp) (license purchase required). **Note!** This sender is not actively supported and will eventually be removed from the module.

**Note!** We recommend using a cloud sender (Mailgun or SendGrid), as it has the most features and offloads the sending process to the cloud.

The aspnetEmail sender engine is included for backwards compatibility, but will eventually be removed from the module.
### Configuration Settings in web.config ###
When you install the module using Nuget, the following configuration is added to web.config:
```xml
<configSections>
<section name="epicodeNewsletter" type="BVNetwork.EPiSendMail.Configuration.NewsletterConfigurationSection, BVNetwork.EPiSendMail" />
</configSections>
...
<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderNetSmtp, BVNetwork.EPiSendMail">
<recipientListProviders>
<add name="RecipientList" displayName="Add from one of your Recipient Lists" url="/modules/epicode.newsletter/plugin/recipientitemproviders/recipientprovider.ascx" />
<add name="TextImport" displayName="Import from text" url="/modules/epicode.newsletter/plugin/recipientitemproviders/TextImportProvider.ascx" />
<add name="EPiServerGroup" displayName="Add email addresses from an EPiServer Group" url="/modules/epicode.newsletter/plugin/recipientitemproviders/EPiServerGroupProvider.ascx" />
<add name="CommerceUsers" displayName="Add email addresses from Commerce Contacts" url="/modules/epicode.newsletter/plugin/recipientitemproviders/CommerceUsersProvider.ascx" />
</recipientListProviders>
</epicodeNewsletter>

```
> Note! The configuration section was added in version 3.2.0. Prior to this, the sendertype was stored in `<appSettings>`.
**Important!** When you uninstall the module, you need to remove the settings from web.config manually.

#### Available Sender Engines ####
The default is the MailSenderNetSmtp engine. Change the `senderType` to select another sender engine.
SMTP Server: `<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderNetSmtp, BVNetwork.EPiSendMail">`
Mailgun: `<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderMailgun, BVNetwork.EPiSendMail">`
SendGrid: `<epicodeNewsletter senderType="BVNetwork.EPiSendMail.SendGrid.MailSenderSendGrid, BVNetwork.EPiSendMail.SendGrid">`
> Note! Mailgun and SendGrid requires additional settings.
### Recipient List Providers ###
You can configure which recipient list providers should be available for the user to add
```xml
<recipientListProviders>
<add name="RecipientList" displayName="Add from one of your Recipient Lists" url="/modules/epicode.newsletter/plugin/recipientitemproviders/recipientprovider.ascx" />
<add name="TextImport" displayName="Import from text" url="/modules/epicode.newsletter/plugin/recipientitemproviders/TextImportProvider.ascx" />
<add name="EPiServerGroup" displayName="Add email addresses from an EPiServer Group" url="/modules/epicode.newsletter/plugin/recipientitemproviders/EPiServerGroupProvider.ascx" />
<add name="CommerceUsers" displayName="Add email addresses from Commerce Contacts" url="/modules/epicode.newsletter/plugin/recipientitemproviders/CommerceUsersProvider.ascx" />
</recipientListProviders>
```
> Note! This configuration feature is not available prior to version 3.2.0
### Configuring SMTP ###
When installing the module, the default sender is the built-in SMTP client in .NET. In order to send emails using SMTP, you need to configure the standard `mailSettings` in web.config:
Expand Down Expand Up @@ -100,9 +139,16 @@ You can also use a pick up directory if you have a SMTP server on your network t
**Note!** The `pickupDirectoryLocation` can be on a network share.

### Configuring Mailgun ###
Add the following keys to the `<appSettings>` section in web.config to use Mailgun:
Change the `senderType` to the `<epicodeNewsletter>` section in web.config to use Mailgun:
```xml
<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderMailgun, BVNetwork.EPiSendMail">
...
</epicodeNewsletter>

```
You also need to add the following `<appSettings>` values in order for the Mailgun sender to be able to authenticate aginst it's REST API.

```xml
<add key="Newsletter.SenderType" value="BVNetwork.EPiSendMail.Library.MailSenderMailgun, BVNetwork.EPiSendMail" />
<add key="Mailgun.ApiKey" value="your-mailgun-api-key-here" />
<add key="Mailgun.Domain" value="your-mailgun-domain-here" />
<add key="Mailgun.PublicKey" value="your-mailgun-public-key-here" />
Expand Down
24 changes: 24 additions & 0 deletions src/InstallationResources/web.config.install.xdt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<configSections>
<section name="epicodeNewsletter" type="BVNetwork.EPiSendMail.Configuration.NewsletterConfigurationSection, BVNetwork.EPiSendMail"
xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing"/>
</configSections>
<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderNetSmtp, BVNetwork.EPiSendMail"
xdt:Transform="InsertIfMissing">
<recipientListProviders>
<add name="RecipientList"
displayName="Add from one of your Recipient Lists"
url="/modules/epicode.newsletter/plugin/itemproviders/recipientprovider.ascx" />
<add name="TextImport"
displayName="Import from text"
url="/modules/epicode.newsletter/plugin/itemproviders/TextImportProvider.ascx" />
<add name="EPiServerGroup"
displayName="Add email addresses from an EPiServer Group"
url="/modules/epicode.newsletter/plugin/itemproviders/EPiServerGroupProvider.ascx"/>
<add name="CommerceUsers"
displayName="Add email addresses from Commerce Contacts"
url="/modules/epicode.newsletter/plugin/itemproviders/CommerceUsersProvider.ascx"/>
</recipientListProviders>
</epicodeNewsletter>
</configuration>
24 changes: 24 additions & 0 deletions src/InstallationResources/web.config.uninstall.xdt
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<configSections>
<section name="epicodeNewsletter" type="BVNetwork.EPiSendMail.Configuration.NewsletterConfigurationSection, BVNetwork.EPiSendMail"
xdt:Locator="Match(name)" xdt:Transform="Remove"/>
</configSections>
<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderNetSmtp, BVNetwork.EPiSendMail"
xdt:Transform="Remove">
<recipientListProviders>
<add name="RecipientList"
displayName="Add from one of your Recipient Lists"
url="/modules/epicode.newsletter/plugin/itemproviders/recipientprovider.ascx" />
<add name="TextImport"
displayName="Import from text"
url="/modules/epicode.newsletter/plugin/itemproviders/TextImportProvider.ascx" />
<add name="EPiServerGroup"
displayName="Add email addresses from an EPiServer Group"
url="/modules/epicode.newsletter/plugin/itemproviders/EPiServerGroupProvider.ascx"/>
<add name="CommerceUsers"
displayName="Add email addresses from Commerce Contacts"
url="/modules/epicode.newsletter/plugin/itemproviders/CommerceUsersProvider.ascx"/>
</recipientListProviders>
</epicodeNewsletter>
</configuration>
6 changes: 6 additions & 0 deletions src/Newsletter for EPiServer.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Examples", "Examples", "{7E
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EPiCode.Newsletter.SendGrid", "Newsletter.SendGrid\EPiCode.Newsletter.SendGrid.csproj", "{DC95640C-908A-49B6-B460-2157586A5DA2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EPiCode.Newsletter.Configuration", "Newsletter.Configuration\EPiCode.Newsletter.Configuration.csproj", "{495118BF-965F-41B3-8077-4A1D789FCE51}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -37,6 +39,10 @@ Global
{DC95640C-908A-49B6-B460-2157586A5DA2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DC95640C-908A-49B6-B460-2157586A5DA2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DC95640C-908A-49B6-B460-2157586A5DA2}.Release|Any CPU.Build.0 = Release|Any CPU
{495118BF-965F-41B3-8077-4A1D789FCE51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{495118BF-965F-41B3-8077-4A1D789FCE51}.Debug|Any CPU.Build.0 = Debug|Any CPU
{495118BF-965F-41B3-8077-4A1D789FCE51}.Release|Any CPU.ActiveCfg = Release|Any CPU
{495118BF-965F-41B3-8077-4A1D789FCE51}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>10.0.20723</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{495118BF-965F-41B3-8077-4A1D789FCE51}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BVNetwork.EPiSendMail.Configuration</RootNamespace>
<AssemblyName>BVNetwork.EPiSendMail.Configuration</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="NewsletterConfigurationSection1.csd.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>NewsletterConfigurationSection.csd</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
<Service Include="{B4F97281-0DBD-4835-9ED8-7DFB966E87FF}" />
</ItemGroup>
<ItemGroup>
<None Include="NewsletterConfigurationSection.csd">
<Generator>CsdFileGenerator</Generator>
<LastGenOutput>NewsletterConfigurationSection1.csd.cs</LastGenOutput>
</None>
<None Include="NewsletterConfigurationSection.csd.config">
<DependentUpon>NewsletterConfigurationSection.csd</DependentUpon>
</None>
<None Include="NewsletterConfigurationSection.csd.diagram">
<DependentUpon>NewsletterConfigurationSection.csd</DependentUpon>
</None>
<None Include="NewsletterConfigurationSection.csd.xsd">
<DependentUpon>NewsletterConfigurationSection.csd</DependentUpon>
<SubType>Designer</SubType>
</None>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
58 changes: 58 additions & 0 deletions src/Newsletter.Configuration/NewsletterConfigurationSection.csd
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<configurationSectionModel xmlns:dm0="http://schemas.microsoft.com/VisualStudio/2008/DslTools/Core" dslVersion="1.0.0.0" Id="d0ed9acb-0435-4532-afdd-b5115bc4d562" namespace="BVNetwork.EPiSendMail.Configuration" xmlSchemaNamespace="NewsletterConfiguration" xmlns="http://schemas.microsoft.com/dsltools/ConfigurationSectionDesigner">
<typeDefinitions>
<externalType name="String" namespace="System" />
<externalType name="Boolean" namespace="System" />
<externalType name="Int32" namespace="System" />
<externalType name="Int64" namespace="System" />
<externalType name="Single" namespace="System" />
<externalType name="Double" namespace="System" />
<externalType name="DateTime" namespace="System" />
<externalType name="TimeSpan" namespace="System" />
</typeDefinitions>
<configurationElements>
<configurationSection name="NewsletterConfigurationSection" codeGenOptions="Singleton, XmlnsProperty" xmlSectionName="epicodeNewsletter">
<attributeProperties>
<attributeProperty name="SenderType" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="senderType" isReadOnly="false">
<type>
<externalTypeMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/String" />
</type>
</attributeProperty>
</attributeProperties>
<elementProperties>
<elementProperty name="RecipientListProviders" isRequired="false" isKey="false" isDefaultCollection="false" xmlName="recipientListProviders" isReadOnly="false">
<type>
<configurationElementCollectionMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/RecipientListProviders" />
</type>
</elementProperty>
</elementProperties>
</configurationSection>
<configurationElementCollection name="RecipientListProviders" collectionType="AddRemoveClearMap" xmlItemName="recipientListProvider" codeGenOptions="Indexer, AddMethod, RemoveMethod, GetItemMethods">
<itemType>
<configurationElementMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/RecipientListProvider" />
</itemType>
</configurationElementCollection>
<configurationElement name="RecipientListProvider">
<attributeProperties>
<attributeProperty name="Name" isRequired="true" isKey="true" isDefaultCollection="false" xmlName="name" isReadOnly="false">
<type>
<externalTypeMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/String" />
</type>
</attributeProperty>
<attributeProperty name="DisplayName" isRequired="true" isKey="false" isDefaultCollection="false" xmlName="displayName" isReadOnly="false">
<type>
<externalTypeMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/String" />
</type>
</attributeProperty>
<attributeProperty name="Url" isRequired="true" isKey="false" isDefaultCollection="false" xmlName="url" isReadOnly="false">
<type>
<externalTypeMoniker name="/d0ed9acb-0435-4532-afdd-b5115bc4d562/String" />
</type>
</attributeProperty>
</attributeProperties>
</configurationElement>
</configurationElements>
<propertyValidators>
<validators />
</propertyValidators>
</configurationSectionModel>
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0"?>
<!--
<auto-generated>
This code was generated by a tool.
Changes to this file may cause incorrect behavior and will be lost if
the code is regenerated.
</auto-generated>
-->
<configuration>
<configSections>
<section name="epicodeNewsletter" type="BVNetwork.EPiSendMail.Configuration.NewsletterConfigurationSection, BVNetwork.EPiSendMail.Configuration, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"/>
</configSections>
<epicodeNewsletter senderType="BVNetwork.EPiSendMail.Library.MailSenderNetSmtp, BVNetwork.EPiSendMail" xmlns="NewsletterConfiguration">
<recipientListProviders>
<add name="RecipientList"
displayName="Add from one of your Recipient Lists"
url="/modules/epicode.newsletter/plugin/recipientitemproviders/recipientprovider.ascx" />
<add name="TextImport"
displayName="Import from text"
url="/modules/epicode.newsletter/plugin/recipientitemproviders/TextImportProvider.ascx" />
<add name="EPiServerGroup"
displayName="Add email addresses from an EPiServer Group"
url="/modules/epicode.newsletter/plugin/recipientitemproviders/EPiServerGroupProvider.ascx"/>
<add name="CommerceUsers"
displayName="Add email addresses from an EPiServer Group"
url="/modules/epicode.newsletter/plugin/recipientitemproviders/CommerceUsersProvider.ascx"/>
</recipientListProviders>
<!--
This is just a minimal sample configuration file that shows how to declare
the configuration sections.
Because an XML Schema Definition (XSD) is generated for each configuration
section, it should be trivial to edit these files because you have
IntelliSense on the XML definition.
-->
</epicodeNewsletter>
</configuration>
Loading

0 comments on commit eca4c92

Please sign in to comment.