I can write a blog post about this. You will not like the solution though as my relay is running Exim, which isn't as popular these days, but the configuration syntax is actually readable (as opposed to sendmail) and it's very feature-rich (which is what I needed here)