From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Subject: [PATCH] email: allow envelope from overriding from templates Add X-RT-Envelope-From header that will override the envelope from if using sendmailpipe mail sending. diff -ru rt-4.2.9.orig/lib/RT/Interface/Email.pm rt-4.2.9/lib/RT/Interface/Email.pm --- rt-4.2.9.orig/lib/RT/Interface/Email.pm 2014-10-23 18:49:38.000000000 -0300 +++ rt-4.2.9/lib/RT/Interface/Email.pm 2014-10-31 08:14:48.557121324 -0200 @@ -754,7 +754,8 @@ if ($QueueAddressOverride) { $OutgoingMailAddress = $QueueAddressOverride; } else { - $OutgoingMailAddress ||= $Queue->CorrespondAddress + $OutgoingMailAddress ||= $envelope_from + || $Queue->CorrespondAddress || RT->Config->Get('CorrespondAddress'); } } @@ -824,6 +825,9 @@ my $msgid = Encode::decode( "UTF-8", $args{'Entity'}->head->get('Message-ID') || '' ); chomp $msgid; + my $envelope_from = $args{'Entity'}->head->get('X-RT-Envelope-From'); + chomp $envelope_from; + # If we don't have any recipients to send to, don't send a message; unless ( $args{'Entity'}->head->get('To') || $args{'Entity'}->head->get('Cc')