Hey Everyone
I have recently built a mover.pm file which should check the SafeShop Customer Care que and the subject line for certain criteria and then if found move it to the Safeshop - Undeliverable
que and then the last part should close all those emails.
This is mover.pm file I built:
[root@server otrs]# cat /opt/otrs/Kernel/Config/Mover.pm
# --
# Kernel/Config/GenericAgent.pm - config file of generic agent
# Copyright (C) 2002-2004 Martin Edenhofer
# --
# $Id: GenericAgent.pm.dist,v 1.7 2004/02/12 00:55:01 martin Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
package Kernel::Config::Mover;
use strict;
use vars qw($VERSION @ISA @EXPORT %Jobs);
require Exporter;
@ISA = qw(Exporter);
@EXPORT = qw(%Jobs);
$VERSION = '$Revision: 1.7 $';
$VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/;
# -----------------------------------------------------------------------
# config options
# -----------------------------------------------------------------------
%Jobs = (
# --
# [name of job] -> send escalation notifications
# --
# 'send escalation notifications' => {
# Escalation => 1,
# # new ticket properties
# New => {
# Module => 'Kernel::System::GenericAgent::NotifyAgentGroupOfCustomQueue',
# },
# },
# insert your jobs (see Kernel/Config/GenericAgent.pm.examples)
# --
# [name of job] -> move all tickets from SafeShop to Safeshop - Undeliverable
# --
'move tickets from SafeShop Customer Care to Safeshop - Undeliverable' => {
# get all tickets with this properties
Queue => 'SafeShop Customer Care',
Subject => '%Undeliverable%',
# new ticket properties
New => {
Queue => 'Safeshop - Undeliverable',
Note => {
From => 'GenericAgent',
Subject => 'Moved!',
Body => 'Moved from " SafeShop. to .Safeshop - Undeliverable " because they were undeliverable!',
ArticleType => 'note-internal', # note-internal|note-external|note-report
},
},
},
# --
# [name of job] -> move all tickets from SafeShop to Safeshop . Undeliverable(Mail could not be delivered)
# --
'move tickets from SafeShop Customer Care to Safeshop - Undeliverable' => {
# get all tickets with this properties
Queue => 'SafeShop Customer Care',
Subject => '%Mail could not be delivered%',
# new ticket properties
New => {
Queue => 'Safeshop - Undeliverable',
Note => {
From => 'GenericAgent',
Subject => 'Moved!',
Body => 'Moved from " SafeShop. to .Safeshop - Undeliverable " because they were undeliverable!',
ArticleType => 'note-internal', # note-internal|note-external|note-report
},
},
},
# --
# [name of job] -> move all tickets from SafeShop to Safeshop . Undeliverable(Mail delivery failed)
# --
'move tickets from SafeShop Customer Care to Safeshop - Mail delivery failed' => {
# get all tickets with this properties
Queue => 'SafeShop Customer Care',
Subject => '%Mail delivery failed%',
# new ticket properties
New => {
Queue => 'Safeshop - Undeliverable',
Note => {
From => 'GenericAgent',
Subject => 'Moved!',
Body => 'Moved from " SafeShop. to .Safeshop - Undeliverable " because they were undeliverable!',
ArticleType => 'note-internal', # note-internal|note-external|note-report
},
},
},
# --
# [name of job] -> move all tickets from SafeShop to Safeshop . Undeliverable(Mail could not be delivered)
# --
'move tickets from SafeShop Customer Care to Safeshop - Mail could not be delivered' => {
# get all tickets with this properties
Queue => 'SafeShop Customer Care',
Subject => '%Mail could not be delivered%',
# new ticket properties
New => {
Queue => 'Safeshop - Undeliverable',
Note => {
From => 'GenericAgent',
Subject => 'Moved!',
Body => 'Moved from " SafeShop. to .Safeshop - Undeliverable " because they were undeliverable!',
ArticleType => 'note-internal', # note-internal|note-external|note-report
},
},
},
# --
# [name of job] -> close all tickets in queue Safeshop - Undeliverable
# --
'close undeliverables' => {
# get all tickets with this properties
Queue => 'Safeshop - Undeliverable',
States => ['new', 'open'],
Locks => ['unlock'],
# new ticket properties (no option is required, use just the options
# which should be changed!)
New => {
# new queue
Queue => 'Safeshop - Undeliverable',
# possible states (closed successful|closed unsuccessful|open|new|removed)
State => 'closed successful',
# new ticket owner (if needed)
Owner => 'root@localhost',
# if you want to add a Note
Note => {
From => 'GenericAgent',
Subject => ' Safeshop - Undeliverable!',
Body => 'Closed by GenericAgent.pl because it Undeliverable!',
},
},
},
);
# -----------------------------------------------------------------------
# end of config options
# -----------------------------------------------------------------------
1;
I've added it to the cron job but it does not work at all.
When run from the command line I get the following response:
[root@server otrs]# /opt/otrs/bin/GenericAgent.pl -c 'Kernel::Config::Mover'
close undeliverables:
move tickets from SafeShop to Safeshop - Mail could not be delivered:
move tickets from SafeShop to Safeshop - Mail delivery failed:
move tickets from SafeShop to Safeshop - Undeliverable:
Could some one please have a look at this as we get about 200 emails a day and my fingers are starting to hurt from doing this manually.
Thanks
Rudi