Matomo uses a copy of Zend Mail that has last been updated in 2011 (in https://github.com/matomo-org/matomo/issues/2581)
While SMTP isn't the fastest developing protocol, a lot has changed in that time.
So instead of keeping an outdated library or reinventing the wheel, I'd recommend replacing it with a maintained, popular PHP library like PHPmailer or swiftmailer.
Bonus side effect: We would get proper error messages for hard to debug errors instead of things like
fwrite(): send of 6 bytes failed with errno=32 Broken pipe.
Any issue w/ using swiftmailer over PHPMailer? It seems more used.
@diosmosis It doesn't really matter as both are very popular and maintained (last update in the last few days)
I always thought PHPMailer was more popular, but that might be countered by very popular applications like Nextcloud using Swiftmailer