mirror of
https://github.com/floci-io/floci.git
synced 2026-11-25 06:47:41 -05:00
* feat(ses): add SMTP relay configuration to EmulatorConfig Add smtp-host, smtp-port, smtp-user, smtp-pass, and smtp-starttls settings to SesServiceConfig. smtp-host is Optional — when absent or empty, relay is disabled and emails are stored only (existing behavior). * feat(ses): implement SMTP relay with Vert.x MailClient and Mime4j Add SmtpRelay that forwards SES emails to a configured SMTP server using a dedicated Vert.x MailClient built from EmulatorConfig settings. Simple emails are sent as MailMessage with From/To/Cc/Bcc/ReplyTo/ Subject/Text/Html. Raw MIME emails are parsed with Apache Mime4j to extract headers and body, then sent via the same MailClient. When SES Destinations is provided, it is used as the authoritative envelope recipient list (MIME Cc headers do not add extra SMTP recipients). Relay is dispatched asynchronously on a dedicated daemon thread with a 30-second send timeout. Failures are logged with stack traces but never affect the API response. The executor and MailClient are only created when smtp-host is configured and ses.enabled is true, and shut down in @PreDestroy. SesService calls SmtpRelay.relay/relayRaw after storing emails so the inspection endpoint always has the data regardless of relay. Tests: SmtpRelayTest (12 cases) covers simple/raw relay, disabled path, error swallowing, base64 decoding, HTML content type, envelope fallback. SesServiceSmtpTest (5 cases) verifies relay integration and store persistence. * docs(ses): document SMTP relay configuration Add SMTP Relay section to docs/services/ses.md with configuration example, docker-compose snippet with Mailpit, and behavioral notes. Add SMTP settings to the YAML sample and environment variable table in docs/configuration/application-yml.md. * fix(ses): preserve body against attachment overwrite and extract Bcc from raw MIME - extractBodyFromEntity now only sets text/html when not already set, so a text-typed attachment in multipart/mixed cannot clobber the body picked up from multipart/alternative. - doRelayRaw now reads Bcc from MIME headers alongside To/Cc when the caller did not supply Destinations. * fix(ses): initialize Vert.x NTLMEngineImpl at run time for native image The vertx-mail-client dependency brings in io.vertx.ext.mail.impl.sasl.NTLMEngineImpl, whose static state embeds a SecureRandom instance. GraalVM native-image rejects build-time Random/SecureRandom objects because the cached seed makes runtime behavior unpredictable. Mark the class for run-time initialization, matching the existing entry for the Apache HttpClient NTLM engine.