[Rt-devel] [PATCH] Allow to override 'envelope from' from templates

Kevin Falcone falcone at bestpractical.com
Wed Jul 6 10:03:35 EDT 2011


On Wed, Jul 06, 2011 at 04:47:10PM +0300, Timo Teräs wrote:
> Add X-RT-Envelope-From header that will override the envelope
> from if using sendmailpipe mail sending.

Does $OverrideOutgoingMailFrom not provide enough rope for your use
case?  It lets you change envelope from on a per-queue basis

-kevin

>  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
> 
> _______________________________________________
> Come work for us: http://blog.bestpractical.com/2011/06/were-hiring-come-hack-perl-for-best-practical.html
> 2011 Training: http://bestpractical.com/services/training.html
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <http://lists.bestpractical.com/pipermail/rt-devel/attachments/20110706/3741b651/attachment.pgp>


More information about the rt-devel mailing list