Email Overlay and Site_Config

I most be missing something

Trying to retrieve array from site config for sendemail_local overlay.

These set command work great in the SiteConfig except they only take one value.
Set(AcceptSubjectTagRegex, qr{compass\@whatever\.com});
Set(NoSubjectChangeTagRegex, qr{\@whereever\.com});

retrieved using
my $accept_domain = RT->Config->Get(‘AcceptSubjectTagRegex’);
my $nosubchange_email = RT->Config->Get(‘NoSubjectChangeTagRegex’);

Trying to convert to an array like
Set(@TestNoSubjectChangeTagRegex, qw($$));
retrieved using
my @testnosubchange_email = RT->Config->Get(‘TestNoSubjectChangeTagRegex’);

When used like this I get the message that the value is undefined rendering my foreach loop useless. Seee below foreach loop

 foreach $key (@testnosubchange_email) {	
	$RT::Logger->info("Test Key is $key hash @testnosubchange_email\n");
	if ($user->EmailAddress =~ $key) {
		$RT::Logger->info("Test past key is $key\n");

Can someone tell me what I am doing wrong?


The example shown should work, can you share the whole code snippet?

Bad posting of code sent in email


Thanks for the response here is the code

package RT::Action::SendEmail;

use strict;

use warnings;

no warnings qw(redefine);

in response to email from specified domain, suppress subject tag and add

the word Accept at the end

my $orig = RT::Action::SendEmail->can(‘SetSubjectToken’);

*RT::Action::SendEmail::SetSubjectToken = sub {

my $self = shift;

my $id = $self->TransactionObj->Creator;

my $user = RT::User->new(RT->SystemUser);


append “Accept” if the txn creator’s email address matches config

my $accept_domain = RT->Config->Get(‘AcceptSubjectTagRegex’);

my $nosubchange_email = RT->Config->Get(‘NoSubjectChangeTagRegex’);

my @testnosubchange_email = RT->Config->Get(‘TestNoSubjectChangeTagRegex’);

my $key;

$RT::Logger->info("Custom Send Mail Action domain found $accept_domain $nosubchange_email " . $self->TicketObj->id . " " . $user->EmailAddress . “\n”);

if ($user->EmailAddress =~ $accept_domain) {

$RT::Logger->info("Custom Send Mail Action domain found Matched If $accept_domain " . $self->TicketObj->id . " " . $user->EmailAddress . “\n”);

my $subject;

try to pull out original subject to avoid prepending AutoReply: etc

(this code borrowed from SetSubject)

my $message = RT::Attachments->new( $self->CurrentUser );

$message->Limit( FIELD => ‘TransactionId’, VALUE => $self->TransactionObj->id);

$message->OrderBy( FIELD => ‘id’, ORDER => ‘ASC’ );


if ( my $first = $message->First ) {

$subject = $first->GetHeader(‘Subject’);


couldn’t pull out the subject. fall back to whatever the original

mail had.

if (!$subject) {

my $head = $self->TemplateObj->MIMEObj->head;

$subject = Encode::decode( “UTF-8”, $head->get(‘Subject’) );


canonicalization also courtesy of SetSubject

$subject = ‘’ unless defined $subject;

chomp $subject;

$subject =~ s/(\r\n|\n|\s)/ /g;

append Accept and set it on the message

$subject = ‘RE: ’ . $subject . ’ ACCEPT’;

$self->SetHeader(Subject => $subject);




Seem to have found the issue. The issue was a scoping issue.


Bryon Baker

Network Operations Manager

Copesan - Specialists in Pest Solutions

800-267-3726 Ext. 2296 • 262-783-6261 Ext. 2296

"Servicing North America with Local Care"