Apical.SendGridMailer.MediatR
1.0.1
dotnet add package Apical.SendGridMailer.MediatR --version 1.0.1
NuGet\Install-Package Apical.SendGridMailer.MediatR -Version 1.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Apical.SendGridMailer.MediatR" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Apical.SendGridMailer.MediatR" Version="1.0.1" />
<PackageReference Include="Apical.SendGridMailer.MediatR" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Apical.SendGridMailer.MediatR --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Apical.SendGridMailer.MediatR, 1.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Apical.SendGridMailer.MediatR@1.0.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Apical.SendGridMailer.MediatR&version=1.0.1
#tool nuget:?package=Apical.SendGridMailer.MediatR&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
📧 SendGrid Email Service for ASP.NET Core
A modular, plug-and-play email service for .NET 9+ projects, featuring:
- ✅ SendGrid integration
- ✅ MediatR command handling
- ✅ Typed configuration via
IOptions<EmailSettings> - ✅ Built-in controller with support for text/HTML emails and attachments
- ✅ Clean architecture — ideal for use as a NuGet package or shared module
🚀 Features
- Send email with both HTML and plain text bodies
- Attach multiple files via
multipart/form-data - Uses MediatR for decoupled command handling
- Configuration via
appsettings.json - Ready-to-use
EmailControllerbuilt into the library - Designed for separation of concerns (can be plugged into any ASP.NET Core API)
📦 Installation
Option 1: Install from NuGet
dotnet add package Apical.SendGridMailer.MediatR
Option 2: Local Project Reference
<ProjectReference Include="..\Apical.SendGridMailer\Apical.SendGridMailer.MediatR.csproj" />
🛠 Configuration
appsettings.json in your API project
"EmailSettings": {
"ApiKey": "YOUR_SENDGRID_API_KEY",
"FromEmail": "you@example.com",
"FromName": "Your Name"
}
🧩 Integration Steps
1. Register Services in Program.cs
builder.Services.AddEmailServices(builder.Configuration); // Extension method from package
2. Use the Built-in API Endpoint
POST /api/email/send
Content-Type: multipart/form-data
Form Fields:
- toEmail
- subject
- htmlBody
- textBody
- attachments[] (optional files)
📁 Folder Structure
Apical.SendGridMailer.MediatR/
├── Features/ // MediatR command + handler
├── Interfaces/ // IEmailDispatcher
├── Services/ // SendGridEmailSender (implements IEmailDispatcher)
├── Models/ // EmailSettings (for IOptions)
├── Extensions/ // AddEmailServices() for DI setup
🔒 Security
This library depends on SendGrid — keep your API key safe. Use Azure Key Vault or environment secrets in production.
📄 License
MIT — free for personal and commercial use.
🧑💻 Author
Yaseer Arafat 🔗 LinkedIn 🛠 Founder at Apical Automate
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- MediatR (>= 12.5.0)
- Microsoft.Extensions.Configuration (>= 9.0.5)
- Microsoft.Extensions.Options (>= 9.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.5)
- SendGrid (>= 9.29.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.