Filter by requestor email domain

Hey there,
I’m looking to not auto-reply on create to inbound emails from a certain
domain ( anything@example.com and even anything@sd.example.com). I suppose
the right way to go about this is via user defined condition in the global
scrip for autoreply on create. I have steps 1 and 3… what’s step 2?

1 return 0 unless $self->TransactionObj->Type eq “Create”;
2 return 0 if #self->TicketObj->???
3 return 1

thanks
ram

Hi,

We had a similar requirement for a bunch of e-mail addresses.

This can be achieved by editing the autoreply scrip to look something like
this:

  • Condition: User Defined
  • Action: Auto Reply To Requestors
  • Template: Your AutoReply template
  • Stage: TransactionCreate
  • Custom Condition:

my @exceptionList = (‘name1@example.com’,
‘name2@example.com’,
‘name3@example.com’);

my $transactionType = $self->TransactionObj->Type;
my $ticketRequestor = lc($self->TicketObj->RequestorAddresses);
my $trans = $self->TransactionObj;

if ($transactionType eq ‘Create’) {
return if grep { $ticketRequestor eq lc($_) } @exceptionList;
my $msgattr = $trans->Message->First;
return 0 unless $msgattr;
return 1 if $msgattr->GetHeader(‘Received’);
}
return 0;

In addition the above only sends an autoreply when someone sends an e-mail,
in our case we don’t like the autoreply mails when we manually create a
ticket (e.g. via quick create).

Hope this helps.

– Bart

Op 25 januari 2012 21:02 schreef Ram Moskovitz ram0502@gmail.com het
volgende:

bestpractical

Please let me know how to unsubscribe to your emails.

ThanksOn 1/30/2012 2:41 AM, Bart wrote:

Hi,

We had a similar requirement for a bunch of e-mail addresses.

This can be achieved by editing the autoreply scrip to look something
like this:

  • Condition: User Defined
  • Action: Auto Reply To Requestors
  • Template: Your AutoReply template
  • Stage: TransactionCreate
  • Custom Condition:

my @exceptionList = (‘name1@example.com mailto:name1@example.com’,
‘name2@example.com mailto:name2@example.com’,
‘name3@example.com mailto:name3@example.com’);

my $transactionType = $self->TransactionObj->Type;
my $ticketRequestor = lc($self->TicketObj->RequestorAddresses);
my $trans = $self->TransactionObj;

if ($transactionType eq ‘Create’) {
return if grep { $ticketRequestor eq lc($_) } @exceptionList;
my $msgattr = $trans->Message->First;
return 0 unless $msgattr;
return 1 if $msgattr->GetHeader(‘Received’);
}
return 0;

In addition the above only sends an autoreply when someone sends an
e-mail, in our case we don’t like the autoreply mails when we manually
create a ticket (e.g. via quick create).

Hope this helps.

– Bart

Op 25 januari 2012 21:02 schreef Ram Moskovitz <ram0502@gmail.com
mailto:ram0502@gmail.com> het volgende:

Hey there,
I'm looking to not auto-reply on create to inbound emails from a
certain domain ( anything@example.com
<mailto:anything@example.com> and even anything@sd.example.com
<mailto:anything@sd.example.com>). I suppose the right way to go
about this is via user defined condition in the global scrip for
autoreply on create. I have steps 1 and 3.. what's step 2?

1 return 0 unless $self->TransactionObj->Type eq "Create";
2 return 0 if #self->TicketObj->????
3 return 1

thanks
ram


--------
RT Training Sessions (http://bestpractical.com/services/training.html)
* Boston --- March 5 & 6, 2012

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

  • Boston — March 5& 6, 2012

Thanks Bart,
That looks good. I’m having an issue with it though - I need to match
against a regexp for the exception list… I added an entry like ‘*@
example.com’ to @exceptionlist and rt is still sending out create
confirmations. What am I missing?
thanks!On Mon, Jan 30, 2012 at 2:41 AM, Bart bart@pleh.info wrote:

Hi,

We had a similar requirement for a bunch of e-mail addresses.

This can be achieved by editing the autoreply scrip to look something like
this:

  • Condition: User Defined
  • Action: Auto Reply To Requestors
  • Template: Your AutoReply template
  • Stage: TransactionCreate
  • Custom Condition:

my @exceptionList = (‘name1@example.com’,
‘name2@example.com’,
‘name3@example.com’);

my $transactionType = $self->TransactionObj->Type;
my $ticketRequestor = lc($self->TicketObj->RequestorAddresses);
my $trans = $self->TransactionObj;

if ($transactionType eq ‘Create’) {
return if grep { $ticketRequestor eq lc($_) } @exceptionList;
my $msgattr = $trans->Message->First;
return 0 unless $msgattr;
return 1 if $msgattr->GetHeader(‘Received’);
}
return 0;

In addition the above only sends an autoreply when someone sends an
e-mail, in our case we don’t like the autoreply mails when we manually
create a ticket (e.g. via quick create).

Hope this helps.

– Bart

Op 25 januari 2012 21:02 schreef Ram Moskovitz ram0502@gmail.com het
volgende:

Hey there,
I’m looking to not auto-reply on create to inbound emails from a certain
domain ( anything@example.com and even anything@sd.example.com). I
suppose the right way to go about this is via user defined condition in the
global scrip for autoreply on create. I have steps 1 and 3… what’s step 2?

1 return 0 unless $self->TransactionObj->Type eq “Create”;
2 return 0 if #self->TicketObj->???
3 return 1

thanks
ram


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

  • Boston — March 5 & 6, 2012

I think your exception list is ok, but this line basically tells the if
statement that the content needs to exactly match your list:

return if grep { $ticketRequestor eq lc($_) } @exceptionList;

Instead of eq you could try using =~ instead, below a little info:

You might also need to edit the exception list with /@example.com/, or
something like that.

Maybe someone with a little more programming skills can reply on this :slight_smile:
I’m not sure if the above would work.

– Bart

Op 2 februari 2012 21:56 schreef Ram Moskovitz ram0502@gmail.com het
volgende:

Yep changed the comparison from equality (eq) to match reg-exp (=~) and
was a bit more careful with my expression…

‘.*?@example.com’,

The ? makes the * ‘non-greedy’ and the back-slashes make the dots literal.

thanks Bart,
ramOn Fri, Feb 3, 2012 at 1:45 AM, Bart bart@pleh.info wrote:

I think your exception list is ok, but this line basically tells the if
statement that the content needs to exactly match your list:

return if grep { $ticketRequestor eq lc($_) } @exceptionList;

Instead of eq you could try using =~ instead, below a little info:

Perl Regular Expressions

You might also need to edit the exception list with /@example.com/, or
something like that.

Maybe someone with a little more programming skills can reply on this :slight_smile:
I’m not sure if the above would work.

– Bart

Op 2 februari 2012 21:56 schreef Ram Moskovitz ram0502@gmail.com het
volgende:

Thanks Bart,

That looks good. I’m having an issue with it though - I need to match
against a regexp for the exception list… I added an entry like ‘*@
example.com’ to @exceptionlist and rt is still sending out create
confirmations. What am I missing?
thanks!

On Mon, Jan 30, 2012 at 2:41 AM, Bart bart@pleh.info wrote:

Hi,

We had a similar requirement for a bunch of e-mail addresses.

This can be achieved by editing the autoreply scrip to look something
like this:

  • Condition: User Defined
  • Action: Auto Reply To Requestors
  • Template: Your AutoReply template
  • Stage: TransactionCreate
  • Custom Condition:

my @exceptionList = (‘name1@example.com’,
‘name2@example.com’,
‘name3@example.com’);

my $transactionType = $self->TransactionObj->Type;
my $ticketRequestor = lc($self->TicketObj->RequestorAddresses);
my $trans = $self->TransactionObj;

if ($transactionType eq ‘Create’) {
return if grep { $ticketRequestor eq lc($_) } @exceptionList;
my $msgattr = $trans->Message->First;
return 0 unless $msgattr;
return 1 if $msgattr->GetHeader(‘Received’);
}
return 0;

In addition the above only sends an autoreply when someone sends an
e-mail, in our case we don’t like the autoreply mails when we manually
create a ticket (e.g. via quick create).

Hope this helps.

– Bart

Op 25 januari 2012 21:02 schreef Ram Moskovitz ram0502@gmail.com het
volgende:

Hey there,
I’m looking to not auto-reply on create to inbound emails from a
certain domain ( anything@example.com and even anything@sd.example.com).
I suppose the right way to go about this is via user defined condition in
the global scrip for autoreply on create. I have steps 1 and 3… what’s
step 2?

1 return 0 unless $self->TransactionObj->Type eq “Create”;
2 return 0 if #self->TicketObj->???
3 return 1

thanks
ram


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

  • Boston — March 5 & 6, 2012