diff --git a/src/Plugin/Mail/SMTPMailSystem.php b/src/Plugin/Mail/SMTPMailSystem.php index 6d5302a2..db0042a5 100644 --- a/src/Plugin/Mail/SMTPMailSystem.php +++ b/src/Plugin/Mail/SMTPMailSystem.php @@ -125,6 +125,13 @@ public function mail(array $message) { $headers['Reply-To'] = $from; } + // Override the from value with the value provided in the header. + // The header switch will copy back the value. + if (!empty($headers['From'])) { + $from = ''; + $headers['Sender'] = $headers['From']; + } + // Defines the From value to what we expect. $mailer->From = $from; $mailer->FromName = $from_name;