using InnovEnergy.App.Backend.DataTypes; using MailKit.Net.Smtp; using MimeKit; namespace InnovEnergy.App.Backend.Mailer; public static class Mailer { public static Boolean SendVerificationMessage (User emailRecipientUser) { var email = new MimeMessage(); email.From.Add(new MailboxAddress("InnovEnergy", "noreply@innov.energy")); email.To.Add(new MailboxAddress(emailRecipientUser.Name, "fern95@ethereal.email")); email.Subject = "Create a new password for your Innovenergy-Account"; email.Body = new TextPart(MimeKit.Text.TextFormat.Plain) { Text = "Dear " + emailRecipientUser.Name + "\n Please create a new password for your Innovenergy-account." + "\n To do this just login at https://HEEEEELP" }; using (var smtp = new SmtpClient()) { smtp.Connect("smtp.ethereal.email", 587, false); // Todo put me into urlAndKey.json smtp.Authenticate("fern95@ethereal.email", "dYKVnc4RQNEFckHaNV"); smtp.Send(email); smtp.Disconnect(true); } return true; } }