Looking for an example of how to send a different autoreply text based on the email address receiving the ticket

Hi,

We have 2 email addresses (1 for english speaking clients and 1 for
french speaking clients) that receive ticket requests.

I was wondering if anyone can help with an example of a scrip that would
send a different autoreply (english reply if sent to support@domain.com)
(french reply with sent to supporttechnique@domain.com) when a new
ticket is created in the general queue depending on the email address
that the ticket was sent to.

So if I understand how it works, the template would contain some perl
code that examines the email address to and auto-replies using one text
else it replies with another text.

Thanks in advance,

Gilbert.

Hi,

can’t you have two different queues, one for each language, with its own
autoreply template ?

Rapha�l MOUNEYRES

Gilbert Rebeiro gilbert@dido.ca
Envoy� par : rt-users-bounces@lists.bestpractical.com
16/08/2011 19:59

A
rt-users@lists.bestpractical.com
cc

Objet
[rt-users] Looking for an example of how to send a different autoreply
text based on the email address receiving the ticket

Hi,

We have 2 email addresses (1 for english speaking clients and 1 for
french speaking clients) that receive ticket requests.

I was wondering if anyone can help with an example of a scrip that would
send a different autoreply (english reply if sent to support@domain.com)
(french reply with sent to supporttechnique@domain.com) when a new
ticket is created in the general queue depending on the email address
that the ticket was sent to.

So if I understand how it works, the template would contain some perl
code that examines the email address to and auto-replies using one text
else it replies with another text.

Thanks in advance,

Gilbert.

" Ce courriel et les documents qui lui sont joints peuvent contenir des
informations confidentielles ou ayant un caract�re priv�. S’ils ne vous sont
pas destin�s, nous vous signalons qu’il est strictement interdit de les
divulguer, de les reproduire ou d’en utiliser de quelque mani�re que ce
soit le contenu. Si ce message vous a �t� transmis par erreur, merci d’en
informer l’exp�diteur et de supprimer imm�diatement de votre syst�me
informatique ce courriel ainsi que tous les documents qui y sont attach�s."

" This e-mail and any attached documents may contain confidential or
proprietary information. If you are not the intended recipient, you are
notified that any dissemination, copying of this e-mail and any attachments
thereto or use of their contents by any means whatsoever is strictly
prohibited. If you have received this e-mail in error, please advise the
sender immediately and delete this e-mail and all attached documents
from your computer system."

Hi,

We have 2 email addresses (1 for english speaking clients and 1 for
french speaking clients) that receive ticket requests.

I was wondering if anyone can help with an example of a scrip that
would send a different autoreply (english reply if sent to
support@domain.com) (french reply with sent to
supporttechnique@domain.com) when a new ticket is created in the
general queue depending on the email address that the ticket was
sent to.

So if I understand how it works, the template would contain some
perl code that examines the email address to and auto-replies using
one text else it replies with another text.

My idea (untested, needs error checking):

  • create two standard templates: autoreply-fr, autoreply-en
  • use a Custom action for the autoreply scrip with the following prepare code:

my $lang;

foreach my $header(qw(To Cc)) {
last (if $lang );
foreach my $recipient (Email::Address->parse($message->head->get( $header ) ) ) {
if ( $recipient =~ /^support@domain.com$/ ) {
$lang = ‘en’;
last;
} elsif ( $recipient =~ /^supporttechnique@domain.com$/ ) {
$lang = ‘fr’;
last;
}
}
}

Default to english

$lang = ‘en’ unless ( $lang );

my $Template = RT::Template->new( $RT::SystemUser );
$Template->Load(“autoreply-”.$lang);

require RT::Action::Autoreply;
bless($self, ‘RT::Action::Autoreply’);
$self->{Argument} = ‘Requestor’;
$self->{TemplateObj} = $Template;
$self->Prepare;
return 1;

You can of course also use the header parsing code directly in the template, but I like the idea to have template per language.

Hi,

Well finally the client has agreed to use a second queue and simple
normal auto-reply template.

Thanks very much for your help.

I think multi-language support in templates would be useful these days.

Gilbert.On 17/08/2011 9:35 AM, Emmanuel Lacour wrote:

On Tue, Aug 16, 2011 at 01:59:46PM -0400, Gilbert Rebeiro wrote:

Hi,

We have 2 email addresses (1 for english speaking clients and 1 for
french speaking clients) that receive ticket requests.

I was wondering if anyone can help with an example of a scrip that
would send a different autoreply (english reply if sent to
support@domain.com) (french reply with sent to
supporttechnique@domain.com) when a new ticket is created in the
general queue depending on the email address that the ticket was
sent to.

So if I understand how it works, the template would contain some
perl code that examines the email address to and auto-replies using
one text else it replies with another text.

My idea (untested, needs error checking):

  • create two standard templates: autoreply-fr, autoreply-en
  • use a Custom action for the autoreply scrip with the following prepare code:

my $lang;

foreach my $header(qw(To Cc)) {
last (if $lang );
foreach my $recipient (Email::Address->parse($message->head->get( $header ) ) ) {
if ( $recipient =~ /^support@domain.com$/ ) {
$lang = ‘en’;
last;
} elsif ( $recipient =~ /^supporttechnique@domain.com$/ ) {
$lang = ‘fr’;
last;
}
}
}

Default to english

$lang = ‘en’ unless ( $lang );

my $Template = RT::Template->new( $RT::SystemUser );
$Template->Load(“autoreply-”.$lang);

require RT::Action::Autoreply;
bless($self, ‘RT::Action::Autoreply’);
$self->{Argument} = ‘Requestor’;
$self->{TemplateObj} = $Template;
$self->Prepare;
return 1;

You can of course also use the header parsing code directly in the template, but I like the idea to have template per language.


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA September 26& 27, 2011
  • San Francisco, CA, USA October 18& 19, 2011
  • Washington DC, USA October 31& November 1, 2011
  • Melbourne VIC, Australia November 28& 29, 2011
  • Barcelona, Spain November 28& 29, 2011

I think multi-language support in templates would be useful these days.

How do you handle a template sending mail to 4 people at the same time
(all CCs or all Requestors) all of who speak a different language?

There’s some more fundamental changes that need to happen to mail
processing to make it easy.

-kevin

Well it is more that if a client is flagged as french the auto-responder
would be one in french.
If we were communicating with someone it would be a human making the
determination as to which language should be used, if there were 4
people etc.

I would see enabling languages (fr, es, etc) then having default
templates for enabled languages.
The language flag on the user would determine the template used to
auto-respond.

Just my thoughts.On 17/08/2011 1:06 PM, Kevin Falcone wrote:

On Wed, Aug 17, 2011 at 12:44:30PM -0400, Gilbert Rebeiro wrote:

I think multi-language support in templates would be useful these days.
How do you handle a template sending mail to 4 people at the same time
(all CCs or all Requestors) all of who speak a different language?

There’s some more fundamental changes that need to happen to mail
processing to make it easy.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26& 27, 2011
  • San Francisco, CA, USA — October 18& 19, 2011
  • Washington DC, USA — October 31& November 1, 2011
  • Melbourne VIC, Australia — November 28& 29, 2011
  • Barcelona, Spain — November 28& 29, 2011

ok so I created a new queue called fr

I will do a simple autoreply that is bound to this queue.
I used the condition

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;

if ( ($Transaction -> Type eq ‘Create’)
&& !($Ticket->QueueObj->Name eq ‘fr’ ) )
{ return (1); }
else
{return (undef); }

But it doesn’t seem to be limited to only this queue called fr

What am I doing wrong?

Also I would like to have the ticket moved to the general queue after
the auto-reply is there a simple way to do this?

Thanks,
Gilbert.On 17/08/2011 1:38 PM, Gilbert Rebeiro wrote:

Well it is more that if a client is flagged as french the
auto-responder would be one in french.
If we were communicating with someone it would be a human making the
determination as to which language should be used, if there were 4
people etc.

I would see enabling languages (fr, es, etc) then having default
templates for enabled languages.
The language flag on the user would determine the template used to
auto-respond.

Just my thoughts.

On 17/08/2011 1:06 PM, Kevin Falcone wrote:

On Wed, Aug 17, 2011 at 12:44:30PM -0400, Gilbert Rebeiro wrote:

I think multi-language support in templates would be useful these days.
How do you handle a template sending mail to 4 people at the same time
(all CCs or all Requestors) all of who speak a different language?

There’s some more fundamental changes that need to happen to mail
processing to make it easy.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26& 27, 2011
  • San Francisco, CA, USA — October 18& 19, 2011
  • Washington DC, USA — October 31& November 1, 2011
  • Melbourne VIC, Australia — November 28& 29, 2011
  • Barcelona, Spain — November 28& 29, 2011

ok so I created a new queue called fr

I will do a simple autoreply that is bound to this queue.
I used the condition

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;

if ( ($Transaction -> Type eq ‘Create’)
&& !($Ticket->QueueObj->Name eq ‘fr’ ) )
{ return (1); }
else
{return (undef); }

But it doesn’t seem to be limited to only this queue called fr

What am I doing wrong?

Do all the staff in your team speak all languages you provide support
in? Usually it’s not the case. Even if it’s now, later it may be
different. It’s better to use different queues for different languages
and give staff rights depending on language they know.

In this case you don’t need custom conditions. You just use different
mail addresses for different languages (you do it already) and map
addresses to different queues. Override default templates in queues:

Also I would like to have the ticket moved to the general queue after the
auto-reply is there a simple way to do this?

Thanks,
Gilbert.

Well it is more that if a client is flagged as french the auto-responder
would be one in french.
If we were communicating with someone it would be a human making the
determination as to which language should be used, if there were 4 people
etc.

I would see enabling languages (fr, es, etc) then having default templates
for enabled languages.
The language flag on the user would determine the template used to
auto-respond.

Just my thoughts.

I think multi-language support in templates would be useful these days.

How do you handle a template sending mail to 4 people at the same time
(all CCs or all Requestors) all of who speak a different language?

There’s some more fundamental changes that need to happen to mail
processing to make it easy.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26 & 27, 2011
  • San Francisco, CA, USA — October 18 & 19, 2011
  • Washington DC, USA — October 31 & November 1, 2011
  • Melbourne VIC, Australia — November 28 & 29, 2011
  • Barcelona, Spain — November 28 & 29, 2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26 & 27, 2011
  • San Francisco, CA, USA — October 18 & 19, 2011
  • Washington DC, USA — October 31 & November 1, 2011
  • Melbourne VIC, Australia — November 28 & 29, 2011
  • Barcelona, Spain — November 28 & 29, 2011

Best regards, Ruslan.

Hi,

Yes so all do speak all the languages that we support.
I was able to override the auto-reply by deleteing the global scrip and
creating a scrip per queue so that is good.

I created a scrip to move the ticket from my fr queue to the General queue.

Condition: On Create
Action: User Defined
Template: Blank
Stage: TransactionCreate

Custom Condition: return 1;
Custom Action cleanup code:

Change queue

my $newqueue = “General”;
my $T_Obj = $self->TicketObj;

$RT::Logger->info(“Auto assign ticket #”. $T_Obj->id ." to queue #".
$newqueue );
my ($status, $msg) = $T_Obj->SetQueue($newqueue);
unless ($status) {
$RT::Logger->warning(“unable to set new queue: $msg”);
return undef;
}
return 1;

It doesn’t work and I don’t know how to debug it?
Is it being processed?
Where is it going wrong?

Any suggestions would be great.

Thanks,
Gilbert.On 17/08/2011 3:23 PM, Ruslan Zakirov wrote:

On Wed, Aug 17, 2011 at 10:08 PM, Gilbert Rebeirogilbert@dido.ca wrote:

ok so I created a new queue called fr

I will do a simple autoreply that is bound to this queue.
I used the condition

my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;

if ( ($Transaction -> Type eq ‘Create’)
&& !($Ticket->QueueObj->Name eq ‘fr’ ) )
{ return (1); }
else
{return (undef); }

But it doesn’t seem to be limited to only this queue called fr

What am I doing wrong?
Do all the staff in your team speak all languages you provide support
in? Usually it’s not the case. Even if it’s now, later it may be
different. It’s better to use different queues for different languages
and give staff rights depending on language they know.

In this case you don’t need custom conditions. You just use different
mail addresses for different languages (you do it already) and map
addresses to different queues. Override default templates in queues:

http://requesttracker.wikia.com/wiki/Template#What_if_I_want_to_override_a_global_template_for_one_of_my_queues.3F

Also I would like to have the ticket moved to the general queue after the
auto-reply is there a simple way to do this?

Thanks,
Gilbert.

On 17/08/2011 1:38 PM, Gilbert Rebeiro wrote:

Well it is more that if a client is flagged as french the auto-responder
would be one in french.
If we were communicating with someone it would be a human making the
determination as to which language should be used, if there were 4 people
etc.

I would see enabling languages (fr, es, etc) then having default templates
for enabled languages.
The language flag on the user would determine the template used to
auto-respond.

Just my thoughts.

On 17/08/2011 1:06 PM, Kevin Falcone wrote:

On Wed, Aug 17, 2011 at 12:44:30PM -0400, Gilbert Rebeiro wrote:

I think multi-language support in templates would be useful these days.

How do you handle a template sending mail to 4 people at the same time
(all CCs or all Requestors) all of who speak a different language?

There’s some more fundamental changes that need to happen to mail
processing to make it easy.

-kevin


RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26& 27, 2011
  • San Francisco, CA, USA — October 18& 19, 2011
  • Washington DC, USA — October 31& November 1, 2011
  • Melbourne VIC, Australia — November 28& 29, 2011
  • Barcelona, Spain — November 28& 29, 2011

RT Training Sessions (http://bestpractical.com/services/training.html)

  • Chicago, IL, USA — September 26& 27, 2011
  • San Francisco, CA, USA — October 18& 19, 2011
  • Washington DC, USA — October 31& November 1, 2011
  • Melbourne VIC, Australia — November 28& 29, 2011
  • Barcelona, Spain — November 28& 29, 2011