In discussing T207621, we realized that automated integration testing for email sending from MediaWiki would be helpful. It would help us feel more confident that refactoring or adding new functionality to the mail subsystem in MW doesn't cause regressions.
Ideally, end-to-end automation would trigger email sending functionality through the Web interface, code, or the API, and would then use SMTP and POP3 or IMAP to test that the message arrives with the correct content and headers.