3 emails sent by correspondance by user

Hello,

I have this case :

  • a (privilieged) user sends a request to RT for a task he has to do.
  • people managing tickets assign it to him, and put it in a queue he
    is admincc for

So this user is requestor, owner, and admincc : he gets 3 emails on
each correspondance. Is it possible to grep|sort|uniq email addresses
before sending notifications to avoid this behaviour ?

Thanks!
L.B.

I have this case :

  • a (privilieged) user sends a request to RT for a task he has to do.
  • people managing tickets assign it to him, and put it in a queue he
    is admincc for

So this user is requestor, owner, and admincc : he gets 3 emails on
each correspondance. Is it possible to grep|sort|uniq email addresses
before sending notifications to avoid this behaviour ?

There is address duplication prevention code in RT, but it only
operates on a per-message basis. The way we solved this problem was
to unify the scrips so that less messages were sent. If you have
owner and admincc being sent e-mail by the same Scrip, then it will
cut from two to one.

I haven’t found a solution to Requestor and AdminCC duplicates,
because AdminCC is sent a different template.

Jo Rhett
Net Consonance : consonant endings by net philanthropy, open source
and other randomness

Ok, I modified Notify.pm . Note I’m note a perl guru, but heh, it works.

This is what the patch does :

  • always send an email to the requestor for a correspondance (“Reply”)
  • if user is requestor and owner, do not send to the owner (an email
    has already been sent to the requestor)
  • if a user is requestor or owner and admincc, remove him from the
    list of admincc (as he has already been notified either because he’s a
    requestor or a owner) and send the email to this list of admincc .

That also means the template received by the user depends on his role
(sometimes he will receive the requestor template, sometimes the
owner, sometimes the admincc). But as basically it’s the same thing,
we don’t mind.

This is the patch, it may be useful for others :

diff lib/RT/Action/Notify.pm local/lib/RT/Action/Notify.pm

88a89,93

my $requestor_emails = join(' ',($ticket->Requestors->MemberEmailAddresses));
my $admincc_emails = join(' ',($ticket->AdminCc->MemberEmailAddresses));
my $owner_email = join(' ',($ticket->OwnerObj->EmailAddress));
my $queueadmincc_emails = join(' ',($ticket->QueueObj->AdminCc->MemberEmailAddresses));
my @requestor_emails_array = split(/ /,$requestor_emails);

118c123
< if ( $arg =~ /\bOwner\b/ && $ticket->OwnerObj->id != $RT::Nobody->id ) {

if ( $arg =~ /\bOwner\b/ && $ticket->OwnerObj->id != $RT::Nobody->id && $requestor_emails !~ $owner_email ){

131,132c136,147
< push ( @Bcc, $ticket->AdminCc->MemberEmailAddresses );
< push ( @Bcc, $ticket->QueueObj->AdminCc->MemberEmailAddresses );

Notification already sent for requestor

foreach (@requestor_emails_array){
$admincc_emails =~ s/$//g;
$queueadmincc_emails =~ s/$
//g;
}

Notification already sent for owner

$admincc_emails =~ s/$owner_email//g;
$queueadmincc_emails =~ s/$owner_email//g;

    push ( @Bcc, $admincc_emails );
    push ( @Bcc, $queueadmincc_emails );

This is the test matrix :

ROA | S | P | T
000 | x | x | x
001 | 1 | 1 | A
010 | 1 | 1 | O
011 | 2 | 1 | O
100 | 1 | 1 | R
101 | 2 | 1 | R
110 | 2 | 1 | R
111 | 3 | 1 | R

R : is requestor
O : is owner
A : is admincc

S : Number of emails sent with Standard notify.pm
P : Number of emails sent with Patched notify.pm
T : Template used (Requestor, Owner, AdminCc)

I’ve not managed the Cc part, and the comments because our main
problem was the duplicate emails generated by correspondences.

Any comments welcome
L.B.