RCommon.SendGrid 2.4.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package RCommon.SendGrid --version 2.4.1
                    
NuGet\Install-Package RCommon.SendGrid -Version 2.4.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="RCommon.SendGrid" Version="2.4.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RCommon.SendGrid" Version="2.4.1" />
                    
Directory.Packages.props
<PackageReference Include="RCommon.SendGrid" />
                    
Project file
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 RCommon.SendGrid --version 2.4.1
                    
#r "nuget: RCommon.SendGrid, 2.4.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 RCommon.SendGrid@2.4.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=RCommon.SendGrid&version=2.4.1
                    
Install as a Cake Addin
#tool nuget:?package=RCommon.SendGrid&version=2.4.1
                    
Install as a Cake Tool

RCommon.SendGrid

A SendGrid implementation of the RCommon IEmailService abstraction, enabling email delivery through the SendGrid API using standard System.Net.Mail.MailMessage objects.

Features

  • Implements IEmailService using the SendGrid API client
  • Accepts standard MailMessage objects and converts them to SendGrid messages automatically
  • Supports HTML and plain text email bodies
  • Streams file attachments to the SendGrid API
  • Supports sending to multiple recipients in a single call
  • EmailSent event for post-send notifications
  • API key configuration via the options pattern
  • Fluent DI registration through the AddRCommon() builder

Installation

dotnet add package RCommon.SendGrid

Usage

using RCommon;

services.AddRCommon()
    .WithSendGridEmailServices(settings =>
    {
        settings.SendGridApiKey = "your-sendgrid-api-key";
        settings.FromEmailDefault = "noreply@example.com";
        settings.FromNameDefault = "My Application";
    });

Then inject and use IEmailService:

using RCommon.Emailing;
using System.Net.Mail;

public class NotificationService
{
    private readonly IEmailService _emailService;

    public NotificationService(IEmailService emailService)
    {
        _emailService = emailService;
    }

    public async Task SendWelcomeEmailAsync(string toAddress)
    {
        var message = new MailMessage("noreply@example.com", toAddress)
        {
            Subject = "Welcome!",
            Body = "<h1>Welcome to our app</h1>",
            IsBodyHtml = true
        };

        await _emailService.SendEmailAsync(message);
    }
}

Key Types

Type Description
SendGridEmailService IEmailService implementation that sends email via the SendGrid API
SendGridEmailSettings Configuration for the SendGrid API key and default sender details
SendGridEmailingConfigurationExtensions Provides WithSendGridEmailServices() for the RCommon builder

Documentation

For full documentation, visit rcommon.com.

License

Licensed under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  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 is compatible.  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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.4.2-alpha.0.5 0 3/24/2026
2.4.2-alpha.0.1 0 3/24/2026
2.4.1 99 2/18/2026
2.3.2-alpha.0.3 52 2/18/2026
2.3.2-alpha.0.2 51 2/18/2026
2.3.2-alpha.0.1 56 2/9/2026
2.3.1 158 2/5/2026
2.3.0 96 2/3/2026
2.2.2-alpha.0.1 392 12/11/2025
2.2.1-alpha.0.2 136 10/24/2025
2.2.1-alpha.0.1 143 10/24/2025
2.1.11-alpha.0.2 146 10/24/2025
2.1.11-alpha.0.1 105 7/18/2025
2.1.10 264 7/17/2025
2.1.9-alpha.0.1 149 7/17/2025
2.1.2.4 232 5/21/2025
2.1.2.3 218 5/1/2025
2.1.2.2 468 1/23/2025
2.1.2.1 160 1/17/2025
0.0.0-alpha.0 157 7/17/2025
Loading failed