Files
Plushealthtech/tmp-mailtest/sender/Program.cs
T
Clive e5d1446791
Gitea CI/CD / build (push) Successful in 1m40s
Site pages and AI tasks.
2026-08-20 14:58:52 +10:00

29 lines
832 B
C#

using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Options;
using plushealthtech.Mail;
var options = Options.Create(new SmtpOptions
{
Host = "127.0.0.1",
Port = 2525,
From = "[email protected]",
To = "[email protected]"
});
var sender = new MailSender(options, NullLogger<MailSender>.Instance);
// Same shape as ContactModel.OnPostAsync: em dash in the subject, ASCII body
// plus one em dash in the message, as a user might type.
var subject = "New contact form message — Dr. Vera Test";
var body = string.Join("\n", new[]
{
"Name: Dr. José Ñ test",
"Email: [email protected]",
"",
"Task 13 e2e verification message — please ignore."
});
await sender.SendAsync(subject, body);
Console.WriteLine("sent");