See also chapter "PostMaster". This example will sort emails from "email@example.com" into queue "Some::System::Queue" and will set some ticket free text.
For all X-Header options see "doc/X-OTRS-Headers.txt".
A example of a simple postmaster filter module, save it under Kernel/System/PostMaster/Filter/Simple.pm. You just need 2 functions, new() and Run():
# --
# Kernel/System/PostMaster/Filter/Simple.pm - sub part of PostMaster.pm
# Copyright (C) 2001-2003 Martin Edenhofer <martin+code otrs.org>
# --
# $Id: developer-guide-custom-modules.sgml,v 1.6 2004/04/23 08:21:17 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::System::PostMaster::Filter::Simple;
use strict;
use vars qw($VERSION);
$VERSION = '$Revision: 1.6 $';
$VERSION =~ s/^.*:\s(\d+\.\d+)\s.*$/$1/;
# --
sub new {
my $Type = shift;
my %Param = @_;
# allocate new hash for object
my $Self = {};
bless ($Self, $Type);
$Self->{Debug} = $Param{Debug} || 0;
# get needed objects
foreach (qw(ConfigObject LogObject DBObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
return $Self;
}
# --
sub Run {
my $Self = shift;
my %Param = @_;
if ($Param{GetParam}->{From} =~ /email\@example.com/i) {
$Param{GetParam}->{'X-OTRS-Queue'} = 'Some::System::Queue';
$Param{GetParam}->{'X-OTRS-TicketKey1'} = 'Planet';
$Param{GetParam}->{'X-OTRS-TicketValue1'} = 'Sun';
}
return 1;
}
# --
1; |