29 lines
832 B
C#
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");
|