https://github.com/discourse/discourse/pull/21627
The gist of it is that I’ve come up with an algorithm that works for all versions (I’ve seen in the wild).
- Get the mailing list email address from either
List-PostorX-BeenThereheader - The mail of the sender will be in any of the following headers:
From,Reply-To,X-MailFromorX-Original-From. So iterate over those and return the first that doesn’t match the email address of the mailing list.