diff --git a/Directory.Packages.props b/Directory.Packages.props
index 6f7f8b4..49602c7 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -9,6 +9,9 @@
+
+
+
diff --git a/README.md b/README.md
index 5a37ce8..e6dad04 100644
--- a/README.md
+++ b/README.md
@@ -5,4 +5,14 @@ A collaborative browser-based drawing program written in .NET.
Please see [REQUIREMENTS](docs/requirements.md) for more information.
## UI
-![DrawTogether.NET UI](/docs/images/paintarea-ui.png)
\ No newline at end of file
+![DrawTogether.NET UI](/docs/images/paintarea-ui.png)
+
+## MailGun Configuration
+
+NugetUpdates uses [MailGun](https://mailgun.com/) to send outbound emails (via `FluentEmail.Mailgun`) - and the following two secrets need to be configured in order for that sending to work:
+
+```shell
+cd ./src/NuGetUpdates.Web/
+dotnet user-secrets set "EmailSettings:MailgunDomain" ""
+dotnet user-secrets set "EmailSettings:MailgunApiKey" ""
+```
diff --git a/src/DrawTogether.Email/Class1.cs b/src/DrawTogether.Email/Class1.cs
deleted file mode 100644
index 314b769..0000000
--- a/src/DrawTogether.Email/Class1.cs
+++ /dev/null
@@ -1,5 +0,0 @@
-namespace DrawTogether.Email;
-
-public class Class1
-{
-}
\ No newline at end of file
diff --git a/src/DrawTogether.Email/DrawTogether.Email.csproj b/src/DrawTogether.Email/DrawTogether.Email.csproj
index 3a63532..8d7ca2b 100644
--- a/src/DrawTogether.Email/DrawTogether.Email.csproj
+++ b/src/DrawTogether.Email/DrawTogether.Email.csproj
@@ -6,4 +6,10 @@
enable
+
+
+
+
+
+
diff --git a/src/DrawTogether.Email/EmailSettings.cs b/src/DrawTogether.Email/EmailSettings.cs
new file mode 100644
index 0000000..e6adf77
--- /dev/null
+++ b/src/DrawTogether.Email/EmailSettings.cs
@@ -0,0 +1,12 @@
+namespace DrawTogether.Email;
+
+public class EmailSettings
+{
+ public required string MailgunDomain { get; set; }
+
+ public required string MailgunApiKey { get; set; }
+
+ public required string FromAddress { get; set; }
+
+ public required string FromName { get; set; }
+}
\ No newline at end of file
diff --git a/src/DrawTogether.Email/MailGunEmailSender.cs b/src/DrawTogether.Email/MailGunEmailSender.cs
new file mode 100644
index 0000000..7da6a13
--- /dev/null
+++ b/src/DrawTogether.Email/MailGunEmailSender.cs
@@ -0,0 +1,36 @@
+using FluentEmail.Core.Interfaces;
+using Microsoft.AspNetCore.Identity.UI.Services;
+using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
+
+namespace DrawTogether.Email;
+
+///
+/// Wraps FluentEmail to send emails using MailGun within the context of ASP.NET Core Identity.
+///
+public sealed class MailGunEmailSender : IEmailSender
+{
+ private readonly ILogger _logger;
+ private readonly ISender _mailgunSender;
+ private readonly EmailSettings _emailSettings;
+
+ public MailGunEmailSender(ISender mailgunSender, IOptions emailSettings, ILogger logger)
+ {
+ _logger = logger;
+ _mailgunSender = mailgunSender;
+ _emailSettings = emailSettings.Value;
+ }
+
+ public Task SendEmailAsync(string email, string subject, string htmlMessage)
+ {
+ _logger.LogDebug("Sending email to {Email} with subject {Subject}", email, subject);
+
+ var mailMessage = FluentEmail.Core.Email
+ .From(_emailSettings.FromAddress, _emailSettings.FromName)
+ .To(email)
+ .Subject(subject)
+ .Body(htmlMessage, true);
+
+ return _mailgunSender.SendAsync(mailMessage);
+ }
+}
\ No newline at end of file
diff --git a/src/DrawTogether.Email/ServiceCollectionExtensions.cs b/src/DrawTogether.Email/ServiceCollectionExtensions.cs
new file mode 100644
index 0000000..d513769
--- /dev/null
+++ b/src/DrawTogether.Email/ServiceCollectionExtensions.cs
@@ -0,0 +1,29 @@
+using Microsoft.AspNetCore.Identity.UI.Services;
+using Microsoft.Extensions.Configuration;
+using Microsoft.Extensions.DependencyInjection;
+
+namespace DrawTogether.Email;
+
+public static class ServiceCollectionExtensions
+{
+ public static IServiceCollection AddEmailServices(this IServiceCollection services, IConfiguration configuration)
+ {
+ // check to see if the EmaiLSettings section is configured in the appsettings.json file
+ if (!configuration.GetSection("EmailSettings").Exists())
+ {
+ // bail out early if email is not configured
+ return services;
+ }
+
+ services.Configure(configuration.GetSection("EmailSettings"));
+
+ services.AddFluentEmail(configuration["EmailSettings:FromAddress"], configuration["EmailSettings:FromName"])
+ .AddRazorRenderer()
+ .AddMailGunSender(configuration["EmailSettings:MailgunDomain"],
+ configuration["EmailSettings:MailgunApiKey"]);
+
+ services.AddTransient();
+
+ return services;
+ }
+}
\ No newline at end of file
diff --git a/src/DrawTogether.UI/DrawTogether/DrawTogether.csproj b/src/DrawTogether.UI/DrawTogether/DrawTogether.csproj
index 16bde89..5c11a07 100644
--- a/src/DrawTogether.UI/DrawTogether/DrawTogether.csproj
+++ b/src/DrawTogether.UI/DrawTogether/DrawTogether.csproj
@@ -25,4 +25,8 @@
+
+
+
+
diff --git a/src/DrawTogether.UI/DrawTogether/Program.cs b/src/DrawTogether.UI/DrawTogether/Program.cs
index 912e6f3..113b528 100644
--- a/src/DrawTogether.UI/DrawTogether/Program.cs
+++ b/src/DrawTogether.UI/DrawTogether/Program.cs
@@ -4,6 +4,7 @@
using DrawTogether.Components;
using DrawTogether.Components.Account;
using DrawTogether.Data;
+using DrawTogether.Email;
var builder = WebApplication.CreateBuilder(args);
@@ -15,6 +16,7 @@
builder.Services.AddScoped();
builder.Services.AddScoped();
builder.Services.AddScoped();
+builder.Services.AddEmailServices(builder.Configuration); // add email services
builder.Services.AddAuthentication(options =>
{