From f2f3542e163c534a437944089b801f6134c6b02a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 6 Jul 2011 09:56:57 +0300 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. --- lib/RT/Interface/Email.pm | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/RT/Interface/Email.pm b/lib/RT/Interface/Email.pm index 620ca60..8bd94eb 100644 --- a/lib/RT/Interface/Email.pm +++ b/lib/RT/Interface/Email.pm @@ -343,7 +343,10 @@ sub SendEmail { my $msgid = $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') @@ -408,16 +411,16 @@ sub SendEmail { # SetOutgoingMailFrom if ( RT->Config->Get('SetOutgoingMailFrom') ) { - my $OutgoingMailAddress; + my $OutgoingMailAddress = $envelope_from; if ($TicketObj) { my $QueueName = $TicketObj->QueueObj->Name; my $QueueAddressOverride = RT->Config->Get('OverrideOutgoingMailFrom')->{$QueueName}; if ($QueueAddressOverride) { - $OutgoingMailAddress = $QueueAddressOverride; + $OutgoingMailAddress ||= $QueueAddressOverride; } else { - $OutgoingMailAddress = $TicketObj->QueueObj->CorrespondAddress; + $OutgoingMailAddress ||= $TicketObj->QueueObj->CorrespondAddress; } } -- 1.7.1