STEPS
Create api for public accessibility and the library for the code that will send the email
-
dotnet new webapi -n api
-
dotnet new classlib -n email
Add packages to your Library to send the Emails
-
dotnet add package Microsoft.Extensions.Configuration
-
dotnet add package Sendgrid
-
dotnet add package Microsoft.AspNetCore.Identity.UI.Services
In your api .csproj, add a reference to you class library:
<ItemGroup> <ProjectReference Include="../email/email.csproj" /> </ItemGroup>
In Sendgrid, create your trial account and create an API Key. Then add your SendGrid API key to your appsettings.json file
"SendGrid": { "SecretKey": "" }