Help Desk Software & Beyond
May 23, 2012, 06:27:25 AM *
Welcome, Guest. Please login or register.
To post messages you need to register. We apologize for inconvenience, but this is to prevent spam.
Registration is instant (no email verification) and we do not ask for any personal information.

Login with username, password and session length
News: Welcome to Help Desk Software forum!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [MOD] User Notification email Black-list (TTX version 3.0 and down)  (Read 1362 times)
Paul Nolette
Newbie
*

Karma: 10
Posts: 49


View Profile
« on: January 08, 2009, 03:36:54 PM »

We had a few cases where we didn't want the user notified when a ticket was created via email and when a ticket was updated. For example if we have a data line go down Verizon Buisness emails our helpdesk to notify of the outage, TTX then emails the reply about the ticket being received. Then Verizon bounces the email with an autoresponse that it's an unmonitored account and the message gets added to the ticket. Have something like this? If so here is an email filter. I'm new to Perl but i've tested and used this MOD in vers 2.24 for a week now and works great. As always backup your files before you edit!

In TTXTicket.pm - usernotify routine, find the following and ADD the part in red...
Quote
if ($cfg->get('sendfiles.customer')) {
  $files = TTXData::get('SESSIONFILES');
}
if ($cfg->get('emailfilter')) {
   my @filterlist = split(/\|/, $cfg->get('emailfilter'));
    if (@filterlist ne undef) {
      foreach my $mailfilter (@filterlist) {
        if ($email eq $mailfilter) {
          goto skipsendmail;
        }
      }
    }     
}

TTXMail::sendmail(
 {
   to => $email,
   from => $fromaddr,
   subject => $subject,
   msg => $tmpl,
   files => $files
 }
);
skipsendmail:
if ($cfg->get('emaillist') ne undef) {

Also in TTXTicket.pm - usernotify routine, find the following and ADD the part in red...
Quote
$tmpltmp =~ s/\[%([^]]+)%\]/TTXDictionary::translate($1)/ge;
if ($cfg->get('emailfilter')) {
  my @filterlist = split(/\|/, $cfg->get('emailfilter'));
  if (@filterlist ne undef) {
    foreach my $mailfilter (@filterlist) {
      if ($addr eq $mailfilter) {
        goto skipsendmail1;
      }
    }
  }     
}

TTXMail::sendmail(
 {
   to => $addr,
   from => $fromaddr,
   subject => $subject,
   msg => $tmpltmp,
   files => $files
 }
);
skipsendmail1:

In ttxcfg.cgi add the following. Just add in the emails you want filtered seperated by |
Quote
emailfilter=skip.email@email.com|skip.metoo@email.com

If there was a better way I'd love to hear about it since I'm still learning Perl!


Edit by Sparky:  Pnolette says this was tested in TTX v2.24 however it looks like it should work in any version of TTX including 3.0
« Last Edit: January 08, 2009, 03:55:31 PM by Sparky » Logged
Sparky
Moderator
Hero Member
*****

Karma: 83
Posts: 2,228


stop pushing all those buttons


View Profile
« Reply #1 on: January 08, 2009, 03:49:04 PM »

Seems straightforward enough.

To anyone reading, keep questions and/or issues regarding this mod confined to this thread.
Logged

Did you update the paths in ttxcfg.cgi after moving TTX to your new location?   Undecided
To those seeking help.... please report back when you figure it out.  Cheesy
JamesTan
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #2 on: September 14, 2011, 06:30:29 AM »

##lines added
my $barred=0;if ($cfg->get('emailfilter')) {
  my @filterlist = split(/\|/, $cfg->get('emailfilter'));
  if (@filterlist ne undef) {
    foreach my $mailfilter (@filterlist) {
      if ($email eq $mailfilter) {
        $barred=1;      }
    }
  }
}
if ($barred==0) {##end of lines added
  TTXMail::sendmail(
   {
     to => $email,
#     from => "\"".company($cfg, $ticket)."\" <".$cfg->get('email').">",
     from => "\"".$ticket->{"c7"}."\" <".$ticket->{"c7"}.">",
     subject => $subject,
     msg => $tmpl,
     files => $files
   }
  );
#line added
}#end of line added
Logged
JamesTan
Newbie
*

Karma: 0
Posts: 8


View Profile
« Reply #3 on: September 14, 2011, 06:34:24 AM »

Missed out the comment for the previous post.
For whatever reason, I found that the "goto" statement will not work for my 2.24 version. I make use of a "barred" variable to control the flow.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1 RC3 | SMF © 2001-2006, Lewis Media Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 19 queries.