fix: move sender name to Reply-To

This commit is contained in:
Oliver Booth 2024-10-20 04:07:36 +01:00
parent ee8a2cb569
commit 5d10f251a8
Signed by: oliverbooth
GPG Key ID: 2A862C3F46178E8E

View File

@ -22,7 +22,7 @@ public class ContactController : Controller
{ {
_logger = logger; _logger = logger;
_configuration = configuration; _configuration = configuration;
IConfigurationSection mailConfiguration = configuration.GetSection("Mail"); IConfigurationSection mailConfiguration = configuration.GetSection("Mail");
_destination = mailConfiguration.GetSection("Destination"); _destination = mailConfiguration.GetSection("Destination");
_sender = mailConfiguration.GetSection("Sender"); _sender = mailConfiguration.GetSection("Sender");
@ -61,9 +61,9 @@ public class ContactController : Controller
{ {
await sender.WriteEmail await sender.WriteEmail
.To("Oliver Booth", _destination.Get<string>()) .To("Oliver Booth", _destination.Get<string>())
.From(name, _sender.Get<string>()) .From("Contact via Website", _sender.Get<string>())
.ReplyTo(email) .ReplyTo(name, email)
.Subject($"[Contact via Website] {subject}") .Subject(subject)
.BodyText(message) .BodyText(message)
.SendAsync(); .SendAsync();
} }