This library provides an easy-to-use implementation of Resend-based email delivery. This abstraction with proper interfaces allows email implementation inside of your project with little effort and easy-to-manage integration, and boasts features such as automatic environment name appending as well as robust email templates.
This package depends on the ICG.NetCore.Utilities.Email project for template implementation
The following additional NuGet packages are installed with this extension.
- Resend - For email delivery
- ICG NET Core Utilities Email - For Email Template Configuration
You must have a Resend Account and an API key value to utilize this service.
Standard installation via HuGet Package Manager
Install-Package ICG.NetCore.Utilities.Email.Resend
To setup the needed dependency injection items for this library, add the following line in your DI setup.
services.UseIcgNetCoreUtilitiesEmailResend();
Additionally, you must specify the needed configuration elements within your AppSettings.json file
"ResendServiceOptions": {
"AdminEmail": "[email protected]",
"AdminName": "John Smith",
"ResendApiKey": "YourKey",
"AlwaysTemplateEmails": true,
"AddEnvironmentSuffix": true
},
"EmailTemplateSettings": {
"DefaultTemplatePath": "Template.html",
"AdditionalTemplates": { "SpecialTemplate": "File.html" }
}
Setting | Description |
---|---|
AdminEmail | This is the email address used as the "from" address and also for any usage of the "SendToAdministrator" option |
AdminName | If specified this is the name that will be used for the "From" address on all outbound emails |
ResendApiKey | The API Key to use for default sending of email addresses |
AlwaysTemplateEmails | If selected ALL emails sent will be templated, by default using the "DefaultTemplate" as configured |
AddEnvironmentSuffix | If selected, all outbound emails sent from non-production addresses will have the environment name added to the end of the subject |
DefaultTemplatePath | The path, relative to the application root, where the default HTML template can be found for emails |
AdditionalTemplates | These are name/value pairs of additional templates and totally optional |
Usage is primarily completed by injecting the IEmailService interface into your respective project, and one injected email can be sent with a single line of code.
_ResendService.SendEmail("[email protected]", "My Subject", "<p>Hello!</p>");
Inline documentation exists for all API methods. We will continue to add more to this documentation in the future (PR's Welcome)
ICG has a number of other related projects as well