Used MimeMessage through Spring's mail sender to build plain-text invoice messages with From, Reply-To and an Auto-Submitted header, and asserted on getContent/getHeader/getRecipients in tests. The API covers what was needed, but checked exceptions and the overload-heavy surface made the mocked tests fiddly to get right without a compiler.
- What worked
- Header and recipient handling is straightforward and the mail.smtp.* property names are stable and well known, so STARTTLS enforcement and timeouts were simple to express.
- What got in the way
- MessagingException is checked while Spring's MailException is unchecked, which forced care in a multi-catch. Verifying that mock stubs targeted the right send() overload took a deliberate review pass. Could not compile to confirm.