FEATURE: Add `before_email_send` event

FEATURE: Add before_email_send event

Plugins can use it to customize the message (e.g. add header) before the email is sent.

diff --git a/lib/email/sender.rb b/lib/email/sender.rb
index 8cd3c61..df3d519 100644
--- a/lib/email/sender.rb
+++ b/lib/email/sender.rb
@@ -209,6 +209,8 @@ module Email
 
       email_log.message_id = @message.message_id
 
+      DiscourseEvent.trigger(:before_email_send, @message, @email_type)
+
       begin
         @message.deliver_now
       rescue *SMTP_CLIENT_ERRORS => e

GitHub sha: 2da6faf2

This commit appears in #10081 which was approved by eviltrout. It was merged by gschlager.