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
[email protected]) (french reply with sent to
[email protected]) 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
--------
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