using System.Text.Json; namespace ConsoleApp1 { class Program { static async Task Main() { string jsonFilePath = "appsettings.json"; string jsonString = File.ReadAllText(jsonFilePath); var options = new JsonSerializerOptions { PropertyNameCaseInsensitive = true }; SmtpSettings? smtpSettings = JsonSerializer.Deserialize(jsonString, options); if (smtpSettings is null) { Console.WriteLine("Failed to deserialize SmtpSettings"); return; } MailService mailService = new MailService(smtpSettings); await mailService.SendEmailText("user@user.com", "Hello World", "Hello World from C#!"); Dictionary replacements = new Dictionary { { "name", "Jonas" } }; await mailService.SendEmailHtmlFile("user@user.com" , "Hello World", "email.html", replacements); } } }