Skip to content

Commit 75f574a

Browse files
authored
Merge pull request #10 from geeklearningio/release/0.4.0
Release/0.4.0
2 parents 1b718d5 + 9049250 commit 75f574a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+738
-170
lines changed

GeekLearning.Email.sln

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Email", "src\G
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{01E85AC0-EFEF-4564-9EE9-9A124776B72E}"
99
EndProject
10-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{96D48864-D85C-4364-A96C-3BD8DD86F6E0}"
10+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "items", "items", "{96D48864-D85C-4364-A96C-3BD8DD86F6E0}"
1111
ProjectSection(SolutionItems) = preProject
1212
.gitattributes = .gitattributes
1313
.gitignore = .gitignore
@@ -25,6 +25,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{8DF5B138
2525
EndProject
2626
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Email.Integration.Test", "tests\GeekLearning.Email.Integration.Test\GeekLearning.Email.Integration.Test.xproj", "{86B313ED-41D4-424F-A172-7D0E8EEE5E49}"
2727
EndProject
28+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Email.SendGrid", "src\GeekLearning.Email.SendGrid\GeekLearning.Email.SendGrid.xproj", "{8701FCC7-0420-4E57-9FD5-5B3943FD255E}"
29+
EndProject
30+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Email.InMemory", "src\GeekLearning.Email.InMemory\GeekLearning.Email.InMemory.xproj", "{8C83A791-0A38-4E42-8261-3614B336737E}"
31+
EndProject
32+
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "GeekLearning.Email.Smtp", "src\GeekLearning.Email.Smtp\GeekLearning.Email.Smtp.xproj", "{707CA417-5EED-467A-A449-73A606089835}"
33+
EndProject
2834
Global
2935
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3036
Debug|Any CPU = Debug|Any CPU
@@ -43,6 +49,18 @@ Global
4349
{86B313ED-41D4-424F-A172-7D0E8EEE5E49}.Debug|Any CPU.Build.0 = Debug|Any CPU
4450
{86B313ED-41D4-424F-A172-7D0E8EEE5E49}.Release|Any CPU.ActiveCfg = Release|Any CPU
4551
{86B313ED-41D4-424F-A172-7D0E8EEE5E49}.Release|Any CPU.Build.0 = Release|Any CPU
52+
{8701FCC7-0420-4E57-9FD5-5B3943FD255E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
53+
{8701FCC7-0420-4E57-9FD5-5B3943FD255E}.Debug|Any CPU.Build.0 = Debug|Any CPU
54+
{8701FCC7-0420-4E57-9FD5-5B3943FD255E}.Release|Any CPU.ActiveCfg = Release|Any CPU
55+
{8701FCC7-0420-4E57-9FD5-5B3943FD255E}.Release|Any CPU.Build.0 = Release|Any CPU
56+
{8C83A791-0A38-4E42-8261-3614B336737E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
57+
{8C83A791-0A38-4E42-8261-3614B336737E}.Debug|Any CPU.Build.0 = Debug|Any CPU
58+
{8C83A791-0A38-4E42-8261-3614B336737E}.Release|Any CPU.ActiveCfg = Release|Any CPU
59+
{8C83A791-0A38-4E42-8261-3614B336737E}.Release|Any CPU.Build.0 = Release|Any CPU
60+
{707CA417-5EED-467A-A449-73A606089835}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
61+
{707CA417-5EED-467A-A449-73A606089835}.Debug|Any CPU.Build.0 = Debug|Any CPU
62+
{707CA417-5EED-467A-A449-73A606089835}.Release|Any CPU.ActiveCfg = Release|Any CPU
63+
{707CA417-5EED-467A-A449-73A606089835}.Release|Any CPU.Build.0 = Release|Any CPU
4664
EndGlobalSection
4765
GlobalSection(SolutionProperties) = preSolution
4866
HideSolutionNode = FALSE
@@ -51,5 +69,8 @@ Global
5169
{474EEA84-EBFB-4925-BDC2-619C21E7EBC9} = {01E85AC0-EFEF-4564-9EE9-9A124776B72E}
5270
{EDA94EFF-7FF4-4C79-BC52-93BC7E696FF6} = {68985ADC-F984-4594-AF38-6A6EEFB2DFDE}
5371
{86B313ED-41D4-424F-A172-7D0E8EEE5E49} = {8DF5B138-1052-4991-88EF-FF23AE1DCC34}
72+
{8701FCC7-0420-4E57-9FD5-5B3943FD255E} = {01E85AC0-EFEF-4564-9EE9-9A124776B72E}
73+
{8C83A791-0A38-4E42-8261-3614B336737E} = {01E85AC0-EFEF-4564-9EE9-9A124776B72E}
74+
{707CA417-5EED-467A-A449-73A606089835} = {01E85AC0-EFEF-4564-9EE9-9A124776B72E}
5475
EndGlobalSection
5576
EndGlobal

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/GeekLearning.Email.svg?maxAge=2592000)]()
1+
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/GeekLearning.Email.svg?maxAge=2592000&label=GeekLearning.Email)](https://www.nuget.org/packages/GeekLearning.Email)
2+
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/GeekLearning.Email.InMemory.svg?maxAge=2592000&label=GeekLearning.Email.InMemory)](https://www.nuget.org/packages/GeekLearning.Email.InMemory)
3+
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/GeekLearning.Email.SendGrid.svg?maxAge=2592000&label=GeekLearning.Email.SendGrid)](https://www.nuget.org/packages/GeekLearning.Email.SendGrid)
4+
[![NuGet Pre Release](https://img.shields.io/nuget/vpre/GeekLearning.Email.Smtp.svg?maxAge=2592000&label=GeekLearning.Email.Smtp)](https://www.nuget.org/packages/GeekLearning.Email.Smtp)
25
[![Build Status](https://geeklearning.visualstudio.com/_apis/public/build/definitions/f841b266-7595-4d01-9ee1-4864cf65aa73/28/badge)](#)
36

47
# gl-dotnet-email

samples/GeekLearning.Email.Samples/Controllers/HomeController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public IActionResult Index()
2020
return View();
2121
}
2222

23-
public IActionResult SendEmail()
23+
public async Task<IActionResult> SendEmail()
2424
{
2525
var user = new User
2626
{
@@ -34,7 +34,7 @@ public IActionResult SendEmail()
3434
User = user
3535
};
3636

37-
this.emailSender.SendTemplatedEmail("Invitation", context, user);
37+
await this.emailSender.SendTemplatedEmailAsync("Invitation", context, user);
3838

3939
return RedirectToAction("Index");
4040
}

samples/GeekLearning.Email.Samples/Startup.cs

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Threading.Tasks;
5-
using Microsoft.AspNetCore.Builder;
6-
using Microsoft.AspNetCore.Hosting;
7-
using Microsoft.Extensions.Configuration;
8-
using Microsoft.Extensions.DependencyInjection;
9-
using Microsoft.Extensions.Logging;
10-
using GeekLearning.Storage;
11-
using GeekLearning.Templating;
12-
13-
namespace GeekLearning.Email.Samples
1+
namespace GeekLearning.Email.Samples
142
{
3+
using InMemory;
4+
using Smtp;
5+
using Microsoft.AspNetCore.Builder;
6+
using Microsoft.AspNetCore.Hosting;
7+
using Microsoft.Extensions.Configuration;
8+
using Microsoft.Extensions.DependencyInjection;
9+
using Microsoft.Extensions.Logging;
10+
using SendGrid;
11+
using Storage;
12+
using Templating;
13+
1514
public class Startup
1615
{
1716
public Startup(IHostingEnvironment env)
@@ -38,7 +37,10 @@ public void ConfigureServices(IServiceCollection services)
3837
services.Configure<StorageOptions>(Configuration.GetSection("Storage"));
3938
services.AddTemplating().AddHandlebars();
4039

41-
services.AddEmail();
40+
services.AddEmail()
41+
.AddSendGridEmail()
42+
.AddInMemoryEmail()
43+
.AddSmtpEmail();
4244
services.Configure<EmailOptions>(Configuration.GetSection("Email"));
4345
}
4446

samples/GeekLearning.Email.Samples/appsettings.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@
88
}
99
},
1010
"Email": {
11-
"User": "YOUR_SENDGRID_USER",
12-
"Key": "YOUR_SENDGRID_PASS",
11+
"Provider": {
12+
"Type": "Smtp",
13+
"Parameters": {
14+
"Host": "127.0.0.1",
15+
"Port": "25",
16+
"UserName": "",
17+
"Password": ""
18+
},
19+
},
1320
"DefaultSender": {
1421
"Email": "no-reply@geeklearning.io",
1522
"DisplayName": "Geek Learning"
1623
},
1724
"TemplateStorage": "Templates",
1825
"Mockup": {
19-
"Recipients": [ ],
26+
"Recipients": [],
2027
"Exceptions": {
21-
"Emails": [ ],
22-
"Domains": [ ]
28+
"Emails": [],
29+
"Domains": []
2330
}
2431
}
2532
},

samples/GeekLearning.Email.Samples/project.json

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
22
"dependencies": {
33
"Microsoft.NETCore.App": {
4-
"version": "1.0.0",
4+
"version": "1.0.1",
55
"type": "platform"
66
},
77
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
8-
"Microsoft.AspNetCore.Mvc": "1.0.0",
8+
"Microsoft.AspNetCore.Mvc": "1.0.1",
99
"Microsoft.AspNetCore.Razor.Tools": {
1010
"version": "1.0.0-preview2-final",
1111
"type": "build"
1212
},
1313
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
14-
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
14+
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
1515
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
1616
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
1717
"Microsoft.Extensions.Configuration.Json": "1.0.0",
@@ -20,9 +20,14 @@
2020
"Microsoft.Extensions.Logging.Debug": "1.0.0",
2121
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
2222
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
23-
"GeekLearning.Storage.FileSystem": "0.3.0-*",
24-
"GeekLearning.Templating.Handlebars": "0.3.0-*",
25-
"GeekLearning.Email": "*"
23+
24+
"GeekLearning.Storage.FileSystem": "0.4.*",
25+
"GeekLearning.Templating.Handlebars": "0.4.*",
26+
27+
"GeekLearning.Email": "*",
28+
"GeekLearning.Email.SendGrid": "*",
29+
"GeekLearning.Email.InMemory": "*",
30+
"GeekLearning.Email.Smtp": "*"
2631
},
2732

2833
"tools": {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
5+
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
6+
</PropertyGroup>
7+
8+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.Props" Condition="'$(VSToolsPath)' != ''" />
9+
<PropertyGroup Label="Globals">
10+
<ProjectGuid>8c83a791-0a38-4e42-8261-3614b336737e</ProjectGuid>
11+
<RootNamespace>GeekLearning.Email.InMemory</RootNamespace>
12+
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">.\obj</BaseIntermediateOutputPath>
13+
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
14+
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
15+
</PropertyGroup>
16+
17+
<PropertyGroup>
18+
<SchemaVersion>2.0</SchemaVersion>
19+
</PropertyGroup>
20+
<Import Project="$(VSToolsPath)\DotNet\Microsoft.DotNet.targets" Condition="'$(VSToolsPath)' != ''" />
21+
</Project>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace GeekLearning.Email.InMemory
2+
{
3+
using System.Collections.Generic;
4+
5+
public interface IInMemoryEmailRepository
6+
{
7+
IReadOnlyCollection<InMemoryEmail> Store { get;}
8+
9+
void Save(InMemoryEmail email);
10+
}
11+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace GeekLearning.Email.InMemory
2+
{
3+
public class InMemoryEmail
4+
{
5+
public string Subject { get; set; }
6+
7+
public string MessageText { get; set; }
8+
9+
public string MessageHtml { get; set; }
10+
11+
public IEmailAddress[] To { get; set; }
12+
13+
public IEmailAddress From { get; set; }
14+
}
15+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
namespace GeekLearning.Email.InMemory
2+
{
3+
using Microsoft.Extensions.DependencyInjection;
4+
using Microsoft.Extensions.DependencyInjection.Extensions;
5+
6+
public static class InMemoryEmailExtensions
7+
{
8+
public static IServiceCollection AddInMemoryEmail(this IServiceCollection services)
9+
{
10+
services.TryAddEnumerable(ServiceDescriptor.Transient<IEmailProviderType, InMemoryEmailProviderType>());
11+
services.AddSingleton<IInMemoryEmailRepository, InMemoryEmailRepository>();
12+
return services;
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)