using EmailApi.Models.Requests; using EmailApi.Services; using Microsoft.AspNetCore.Mvc; using Swashbuckle.AspNetCore.Annotations; namespace EmailApi.Controllers; [ApiController] [Route("api/email")] public sealed class EmailController : ControllerBase { private readonly SmtpEmailDispatcher _dispatcher; public EmailController(SmtpEmailDispatcher dispatcher) => _dispatcher = dispatcher; [HttpPost("send")] [SwaggerOperation(Summary = "Send an HTML email via SMTP")] [ProducesResponseType(StatusCodes.Status204NoContent)] public async Task Send([FromBody] SendEmailRequest request, CancellationToken ct) { await _dispatcher.SendAsync(request, ct); return NoContent(); } }