CovenirBPO.Packages.SendgridNotificationSystem 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package CovenirBPO.Packages.SendgridNotificationSystem --version 1.0.1                
NuGet\Install-Package CovenirBPO.Packages.SendgridNotificationSystem -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="CovenirBPO.Packages.SendgridNotificationSystem" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CovenirBPO.Packages.SendgridNotificationSystem --version 1.0.1                
#r "nuget: CovenirBPO.Packages.SendgridNotificationSystem, 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.
// Install CovenirBPO.Packages.SendgridNotificationSystem as a Cake Addin
#addin nuget:?package=CovenirBPO.Packages.SendgridNotificationSystem&version=1.0.1

// Install CovenirBPO.Packages.SendgridNotificationSystem as a Cake Tool
#tool nuget:?package=CovenirBPO.Packages.SendgridNotificationSystem&version=1.0.1                

Sendgrid Notification Library

For Covenir Integration

2024-01-23

Install the library

Install Nuget package CovenirBPO.Packages.SendgridNotificationSystem

Createing a native IEmailNotificationContent object

In your project solution, create an object that inherits the IEmailNotificationContent interface.

This object will contain the required properties that the notification system will utilize when sending notification emails.

using SendgridNotificationSystem.Lib;

namespace SendgridNotificationSystem.Testing;

internal class EmailNotificationContent : IEmailNotificationContent
{
    public List<string> RecipientAddresses { get; set; } = new List<string>();
    public string Subject { get; set; } = string.Empty; 
    public string BodyContent { get; set; } = string.Empty;

    public void AddRecipientAddress(string recipientAddress)
    {
        RecipientAddresses.Add(recipientAddress);
    }

    public void RemoveRecipientAddress(string recipientAddress)
    {
        for (int i = 0; i < RecipientAddresses.Count; i++)
        {
            if (RecipientAddresses[i]== recipientAddress)
            {
                RecipientAddresses.RemoveAt(i);
                break; 
            }   
        }
    }
}

Set an environment variable

Create a local environment variable on the machine that will be sending notifications:

Key Value
SENDGRID_API Your Sendgrid API key

Add Recipients

In the calling assembly, create a new EmailNotificationContent object.

EmailNotificationContent content = new EmailNotificationContent(); 

content.Subject = "Subject of Email"; 
content.BodyContent = "Body of the email"; 
// Note: You may add multiple recipients
content.AddRecipientAddress("receiver@email.com"); 

Call the service

using SendgridNotificationSystem; 

. . .

public async Task SendEmail(IEmailNotificationContent content)
{
    await new Lib.SendgridNotificationSystem()
        .SendSendgridEmailAsync(content);
}
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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on CovenirBPO.Packages.SendgridNotificationSystem:

Package Downloads
CovenirBPO.Packages.PreprocessorCommon

A common core library for Covenir's preprocessor workflow.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.0 392 5/1/2024
1.0.1 225 1/24/2024
1.0.0 105 1/23/2024

Updated some exception handling to provide clearer error messages. Other small bug fixes.