- Notifications
You must be signed in to change notification settings - Fork0
milosh-96/AspNetWebMailer
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is a demo ASP.NET Core 8 project for sending emails.
There are many ways to send emails with ASP.NET, but you can follow this repo as a some sort of reference how to configure your project to be able to send emails via SMTP.
This project usessecrets.json
orappSettings.json
. You should put your SMTP settings in "MailSettings" section.
Application/Mailing/MailService.cs
- this service configures the SMTP client and and has a method that send emails.
Controllers/HomeController.cs
- I decided to keep it simple, so the email service is called from the Index method.
Domain/Settings/MailSettings.cs
- "MailSettings" secton from the configuration file (secrets.json
orappSettings.json
) will be mapped to the properties of this class.
Program.cs
-MailService
is added as a scoped service on the line 13.
ASP.NET Core Identity expects that the mail service class implementsMicrosoft.AspNetCore.Identity.UI.Services.IEmailSender
.
Check out anImplementation here.
It's a slighty modifiedMailService
from this project.