CovenirBPO.Packages.SendgridNotificationSystem
1.0.1
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
<PackageReference Include="CovenirBPO.Packages.SendgridNotificationSystem" Version="1.0.1" />
paket add CovenirBPO.Packages.SendgridNotificationSystem --version 1.0.1
#r "nuget: CovenirBPO.Packages.SendgridNotificationSystem, 1.0.1"
// 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 | Versions 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. |
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.0)
- SendGrid (>= 9.29.1)
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.
Updated some exception handling to provide clearer error messages. Other small bug fixes.