Disable crypting of Autoreplies

If someone needs to have a queue that signs and encrypts messages by default but doesn’t want to encrypt Autoreply, this can not be achieved in the Template (thx Best Practical for the support). The solution is something like:

RT_SiteConfig.pm:
# Don't encrypt autoreplies for some queues
Set(@DontEncryptAutoreply, qw(queuename1 queuename2));

And adapt the mail preparation at the end of RT::Action::SendEmail::Prepare :

my @disabledAutoreplies = RT->Config->Get('DontEncryptAutoreply');
if ( my $attachment = $self->TransactionObj->Attachments->First ) { 
   if ( $self->TransactionObj->Type eq 'Create' && $self->TemplateObj->Name =~ /Autoreply/ && (grep { $_ eq $self->TicketObj->QueueObj->Name } @disabledAutoreplies)) { 
      $attachment->SetHeader( 'X-RT-Encrypt' => 0 );
   }      
}
1 Like