PostMaster Filter Module

Siehe auch das Kapitel "PostMaster". Dieses Beispiel sortiert eMails von "email@example.com" in die Queue "Some::System::Queue" und setzt freien Text.

Für eine Übersicht über alle X-Header-Optionen, siehe "doc/X-OTRS-Headers.txt".

Ein Beispiel eines simplen Postmaster Filter Moduls. Speichern Sie unter Kernel/System/PostMaster/Filter/Simple.pm ab. Es werden nur zwei Funktionen benötigt, 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.5 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.5 $';
$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;