This project demonstrates how to send emails using the SMTP protocol with C# and .NET. The app reads SMTP configuration from an appsettings.json file and sends emails securely.
-
.NET SDK (v9.0 or later)
-
An SMTP server (e.g., Gmail)
-
An App Password (if using Gmail with 2-step verification)
-
Clone the repository:
git clone https://github.com/Cyrille-18/EmailSenderWithCsharp.git
-
Install dependancies:
dotnet restore
Create an appsettings.json file in the project root with the following content:
{
"EmailConfig": {
"SmtpServer": "smtp.gmail.com",
"SmtpPort": 587,
"Email": "youremail@gmail.com",
"AppPassword": "your App password"
}
}