I have multiple email addresses associated with a single queue
For ex: abc@xyz.com as well as pqr@lmn.com pointing to the same queue “queue-one”
We only have an option to set either of these email address in the Reply Address field in the Queue Creation form.
However, I want to configure the reply address dynamically based on the email address…
For ex: If an end user sends an email to abc@xyz.com, auto-alert should be sent via that email as well as upon replies by end user, it should be redirected to the same email address
and vice versa for pqr@lmn.com
Has anyone configured this in RTracker…? Need help around this…
I’m wondering why you just don’t have two queues? You can have the same group(s) of privileged users associated with each, same scrips, etc but each would have a different reply-to email address and you would mail into each one separately. Seems much easier to me. What am I missing?
basically we have multiple sub-orgs and there’s a need to keep some of the functions are common across these sub-orgs
for instance: network related, infosec related tickets
now these sub-orgs will have their own support email id for these functions but we want to just have one queue catering to these requests and reply-to address should be identified on the basis of the sub-org or the origin of the ticket.
how do I dynamically set the reply address based on the requestor…? also I want it to be decided by the queue email address.
for ex: if an end user is sending to abc@xyz.com, reply address should be abc@xyz.com and so on
RT-Attach-Message: yes
From: {
my $from = '111@111.com';
$from = '222@222.com' if ($Ticket->RequestorAddresses =~ /\@gmail.com/);
$from = '333@333.com' if ($Ticket->RequestorAddresses =~ /\@yahoo.com/);
$from = '444@444.com' if ($Ticket->RequestorAddresses =~ /\@hotmail.com/);
$from;
}
{$Transaction->Content()}
Well, after this you get the right From but RT will add Reply-To address to your queue addres. To avoid that add to the template header once more the same for Reply-To. So the final template would be:
RT-Attach-Message: yes
From: {
my $from = '111@111.com';
$from = '222@222.com' if ($Ticket->RequestorAddresses =~ /\@gmail.com/);
$from = '333@333.com' if ($Ticket->RequestorAddresses =~ /\@yahoo.com/);
$from = '444@444.com' if ($Ticket->RequestorAddresses =~ /\@hotmail.com/);
$from;
}
Reply-To: {
my $from = '111@111.com';
$from = '222@222.com' if ($Ticket->RequestorAddresses =~ /\@gmail.com/);
$from = '333@333.com' if ($Ticket->RequestorAddresses =~ /\@yahoo.com/);
$from = '444@444.com' if ($Ticket->RequestorAddresses =~ /\@hotmail.com/);
$from;
}
{$Transaction->Content()}
thanks for the snippet… can this be implemented in a way where in all the auto-replies such as upon ticket creation, replies from technicians to enduser via rtracker, closure and any other mail related activities to follow the approach as expected…?
You can put this to whatever Template you want. Just look to Scrips, find what Templates they use and modify the Templates. Slightly updated code for efficiency (not so many database queries) is here:
RT-Attach-Message: yes
{
my $header1 = "From: ";
my $header2 = "Reply-To: ";
my $requestor = $Ticket->RequestorAddresses || "";
my $from = '111@111.com';
$from = '222@222.com' if ($requestor =~ /\@gmail.com/);
$from = '333@333.com' if ($requestor =~ /\@yahoo.com/);
$from = '444@444.com' if ($requestor =~ /\@hotmail.com/);
$from = $header1 . $from . "\n" . $header2 . $from;
$from;
}
{$Transaction->Content()}
Subject: AutoReply: {$Ticket->Subject}
RT-Attach-Message: yes
{
my $header1 = "From: ";
my $header2 = "Reply-To: ";
my $requestor = $Ticket->RequestorAddresses || “”;
my $from = ‘dummy-itsupport@abc.com’;
$from = ‘dummy-itsupport@pqr.in’ if ($requestor =~ /@pqr.in/);
$from = $header1 . $from . “\n” . $header2 . $from;
$from;
}
Content-Type: text/html
Greetings,
This message has been automatically generated in response to the
creation of a trouble ticket regarding {$Ticket->Subject()},
a summary of which appears below.
There is no need to reply to this message right now. Your ticket has been
assigned an ID of {$Ticket->SubjectTag}.
Please include the string {$Ticket->SubjectTag}
in the subject line of all future correspondence about this issue. To do so,
you may reply to this message.
Is it failing on both From: and Reply-To: now or still just not setting the From: ?
Just as an aside, are you applying this globally? If so, check there isn’t another template also called Autoreply set up for the queue which it’s using instead?
Admin → Queues → (select) → Templates
vs
Admin → Global → Templates
That’s got me in the past. Modifying one and wondering why it’s not having any effect!
Also assuming that $Ticket->RequestorAddresses contains only one address of a requestor. And that after this code you have at least one void line in your template and some text or {$Transaction->Content()} afterwards.
What you could also do is dump out the contents of $requestor just after you create it (with something like warn or RT::Logger->warn()) and see what the string you’re actually trying to do the regexp against is.
I’d also separate out the instantiation of my $from; from the initial conditional assignment to it, so you can give it a default value if neither pattern matches. In other words have something like this:
my $from = 'default@example.com';
$from = 'dummy-itsupport@abc.in' if ($requestor =~ /\@abc.in/);
$from = 'dummy-itsupport@pqr.com' if ($requestor =~ /\@pqr.com/);