automatisches Entfernen von Kürzeln im Betreff
automatisches Entfernen von Kürzeln im Betreff
Hallo an Alle,
ich bin neu hier und hab mal eine Frage zum OTRS (3.2.9).
Wenn ein Kunde eine E-Mail an uns schickt und im Betreff eine Kombination aus zwei Zeichen und Doppelpunkt verwendet, entfernt OTRS diese.
z.B.:
Betreff:< A3: Hallo ihr da >
Daraus wird ein Ticket generiert mit >TicketNummer><Betreff>
z.B.:
Foo4444455 - A3: Hallo ihr da
Im Betreff der E-Mail jedoch taucht "A3:" nicht mehr auf sondern der E-Mail Betreff wird auf <Hallo ihr da> geändert.
Auch in der automatischen Antwort steht nur noch <Re: [Foo4444455] Hallo ihr da>
Auch alle weiteren Antworten auf das Ticket er halten diesen Betreff.
Nun ist es für uns wichtig diese Kürzel im Betreff zu behalten. Wenn wir z.B. <A3 - Hallo ihr da> benutzen wird dies nicht entfernt und "A3 -" bleibt im Betreff erhalten.
Ich hoffe ich konnte deutlich machen welche Funktion / Einstellung ich suche.
Ich würde mich über Antworten hierzu freuen und hoffe dass mir geholfen werden kann. =)
Wenn noch Informationen benötigt werden, werde ich diese natürich nachreichen.
So long.
Mit freundlichen Grüßen,
damiddi
ich bin neu hier und hab mal eine Frage zum OTRS (3.2.9).
Wenn ein Kunde eine E-Mail an uns schickt und im Betreff eine Kombination aus zwei Zeichen und Doppelpunkt verwendet, entfernt OTRS diese.
z.B.:
Betreff:< A3: Hallo ihr da >
Daraus wird ein Ticket generiert mit >TicketNummer><Betreff>
z.B.:
Foo4444455 - A3: Hallo ihr da
Im Betreff der E-Mail jedoch taucht "A3:" nicht mehr auf sondern der E-Mail Betreff wird auf <Hallo ihr da> geändert.
Auch in der automatischen Antwort steht nur noch <Re: [Foo4444455] Hallo ihr da>
Auch alle weiteren Antworten auf das Ticket er halten diesen Betreff.
Nun ist es für uns wichtig diese Kürzel im Betreff zu behalten. Wenn wir z.B. <A3 - Hallo ihr da> benutzen wird dies nicht entfernt und "A3 -" bleibt im Betreff erhalten.
Ich hoffe ich konnte deutlich machen welche Funktion / Einstellung ich suche.
Ich würde mich über Antworten hierzu freuen und hoffe dass mir geholfen werden kann. =)
Wenn noch Informationen benötigt werden, werde ich diese natürich nachreichen.
So long.
Mit freundlichen Grüßen,
damiddi
-
- Znuny ninja
- Posts: 1312
- Joined: 25 May 2012, 08:51
- Znuny Version: OTRS 4
- Real Name: Klaus Nehrer
Re: automatisches Entfernen von Kürzeln im Betreff
Was benutzt ihr als Ticket Hook?
Re: automatisches Entfernen von Kürzeln im Betreff
Hi,
als Ticket Hook ist unser Firmenkürzel eingetragen.
So was wie ... TELEKOM#
Die 2 Zeichen-Kombination gehört ja auch zum Betreff und nicht zum Hook eigentlich.
Nochmal schematisch:
1) Kunde schreibt Mail: "A3: Hallo" -> bei uns kommt nur Mail mit Betreff "Hallo" an
2) OTRS schickt automatische Antwort: Re: [TELEKOM#123456] "Hallo"
Das OTRS entfernt also A3: aus dem Betreff. Dies ist auch nur bei 2 Zeichen kombinationen so.
Ein Betreff mit "AB3: Hallo" bleibt unverändert. =(
Vielen Dank schon mal für die Antwort.
Grüße.
als Ticket Hook ist unser Firmenkürzel eingetragen.
So was wie ... TELEKOM#
Die 2 Zeichen-Kombination gehört ja auch zum Betreff und nicht zum Hook eigentlich.
Nochmal schematisch:
1) Kunde schreibt Mail: "A3: Hallo" -> bei uns kommt nur Mail mit Betreff "Hallo" an
2) OTRS schickt automatische Antwort: Re: [TELEKOM#123456] "Hallo"
Das OTRS entfernt also A3: aus dem Betreff. Dies ist auch nur bei 2 Zeichen kombinationen so.
Ein Betreff mit "AB3: Hallo" bleibt unverändert. =(
Vielen Dank schon mal für die Antwort.
Grüße.
-
- Znuny ninja
- Posts: 1312
- Joined: 25 May 2012, 08:51
- Znuny Version: OTRS 4
- Real Name: Klaus Nehrer
Re: automatisches Entfernen von Kürzeln im Betreff
Wie steht der Betreff den Logs? Was siehst bei der unformatierten Ansicht (Header)?
Sind Postmasterfilter aktiv?
Sind Postmasterfilter aktiv?
Re: automatisches Entfernen von Kürzeln im Betreff
Hallo vielen Dank für die weiteren Anregungen.
Mir ist noch aufgefallen, dass im Thunderbird der Betreff bei der eingehenden Mail (Ticketeröffnung) stimmt. Dort steht "Subject: A3: Fehler - WG: anderes Ticket". In der normalen Ticket Ansicht im OTRS-GUI taucht jedoch "A3:" nicht auf. Bei der automatischen Antwort steht nirgendwo mehr "A3:" im Betreff und wenn man auf antworten klickt auch nicht. Postmasterfilter sind ?aktiv? (s.u.).
+++++++++++++ Frontend::Module###AdminPostMasterFilter +++++++++++++++++++
Frontend::Module###AdminPostMasterFilter
Gruppe: admin
Gruppe ro:
Loader:
Titel: PostMaster Filters
Beschreibung: Admin
NavBarName: Admin
NavBar =>
NavBarModule =>
Modul: Kernel::Output::HTML::NavBarModuleAdmin
Name: PostMaster Filters
Beschreibung: Filter incoming emails.
Block: Email
Priorität: 200
::::::::::::: OTRS Ticket Ansicht (GUI) :::::::::::::::
Betreff: Fehler - WG: anderes Ticket
__________ Mail Header unformatiert__________
Subject: A3: Fehler - WG: anderes Ticket
Date: Tue, 31 Mar 2015 07:55:18 +0200
Message-ID: <A9B6E0DE30C3B04A9EC9482F4D13BD8D0558FE@foo.bar.de>
X-MS-Has-Attach: yes
X-MS-Tnef-Correlator:
Thread-Topic: A3: Fehler - WG: anderes Ticket
============== LOG ================
From foo@bar.de Tue Mar 31 07:55:22 2015
Subject: A3: Fehler - WG: anderes Ticket
Folder: /opt/otrs/bin/otrs.PostMaster.pl 8887
procmail: [20331] Tue Mar 31 10:15:07 2015
procmail: Match on ! "^From.*@example.com"
procmail: Couldn't determine implicit lockfile from "grep"
procmail: Locking ".lock"
procmail: Executing "grep,-vi,^X-OTRS-"
procmail: Unlocking ".lock"
procmail: No match on "TO:.*@example.com"
procmail: No match on "^List-Id:.*OpenAntiVirus"
procmail: No match on "TO:.*@example.com"
procmail: Couldn't determine implicit lockfile from "/opt/otrs/bin/otrs.PostMaster.pl"
procmail: Locking ".lock"
procmail: Executing "/opt/otrs/bin/otrs.PostMaster.pl"
procmail: [20331] Tue Mar 31 10:15:08 2015
procmail: Assigning "LASTFOLDER=/opt/otrs/bin/otrs.PostMaster.pl"
procmail: Unlocking ".lock"
procmail: Notified comsat: "otrs@:/opt/otrs/bin/otrs.PostMaster.pl"
Mir ist noch aufgefallen, dass im Thunderbird der Betreff bei der eingehenden Mail (Ticketeröffnung) stimmt. Dort steht "Subject: A3: Fehler - WG: anderes Ticket". In der normalen Ticket Ansicht im OTRS-GUI taucht jedoch "A3:" nicht auf. Bei der automatischen Antwort steht nirgendwo mehr "A3:" im Betreff und wenn man auf antworten klickt auch nicht. Postmasterfilter sind ?aktiv? (s.u.).
+++++++++++++ Frontend::Module###AdminPostMasterFilter +++++++++++++++++++
Frontend::Module###AdminPostMasterFilter
Gruppe: admin
Gruppe ro:
Loader:
Titel: PostMaster Filters
Beschreibung: Admin
NavBarName: Admin
NavBar =>
NavBarModule =>
Modul: Kernel::Output::HTML::NavBarModuleAdmin
Name: PostMaster Filters
Beschreibung: Filter incoming emails.
Block: Email
Priorität: 200
::::::::::::: OTRS Ticket Ansicht (GUI) :::::::::::::::
Betreff: Fehler - WG: anderes Ticket
__________ Mail Header unformatiert__________
Subject: A3: Fehler - WG: anderes Ticket
Date: Tue, 31 Mar 2015 07:55:18 +0200
Message-ID: <A9B6E0DE30C3B04A9EC9482F4D13BD8D0558FE@foo.bar.de>
X-MS-Has-Attach: yes
X-MS-Tnef-Correlator:
Thread-Topic: A3: Fehler - WG: anderes Ticket
============== LOG ================
From foo@bar.de Tue Mar 31 07:55:22 2015
Subject: A3: Fehler - WG: anderes Ticket
Folder: /opt/otrs/bin/otrs.PostMaster.pl 8887
procmail: [20331] Tue Mar 31 10:15:07 2015
procmail: Match on ! "^From.*@example.com"
procmail: Couldn't determine implicit lockfile from "grep"
procmail: Locking ".lock"
procmail: Executing "grep,-vi,^X-OTRS-"
procmail: Unlocking ".lock"
procmail: No match on "TO:.*@example.com"
procmail: No match on "^List-Id:.*OpenAntiVirus"
procmail: No match on "TO:.*@example.com"
procmail: Couldn't determine implicit lockfile from "/opt/otrs/bin/otrs.PostMaster.pl"
procmail: Locking ".lock"
procmail: Executing "/opt/otrs/bin/otrs.PostMaster.pl"
procmail: [20331] Tue Mar 31 10:15:08 2015
procmail: Assigning "LASTFOLDER=/opt/otrs/bin/otrs.PostMaster.pl"
procmail: Unlocking ".lock"
procmail: Notified comsat: "otrs@:/opt/otrs/bin/otrs.PostMaster.pl"
-
- Znuny guru
- Posts: 5018
- Joined: 13 Mar 2011, 09:54
- Znuny Version: 6.0.x
- Real Name: Renée Bäcker
- Company: Perl-Services.de
- Contact:
Re: automatisches Entfernen von Kürzeln im Betreff
Sind im Adminbereich unter "Postmaster-Filter" irgendwelche Filter eingetragen? Ist in der Kernel/Config.pm oder in der Kernel/Config/Files/ZZZ*.pm irgendwas von PostMaster::PreFilter bzw. PostMaster::PostFilter zu finden?
Perl / Znuny development: http://perl-services.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Free Znuny add ons from the community: http://opar.perl-services.de
Commercial add ons: http://feature-addons.de
Re: automatisches Entfernen von Kürzeln im Betreff
Sind im Adminbereich unter "Postmaster-Filter" irgendwelche Filter eingetragen?
>> Nein
----------------- Kernel/Config/Files/ZZZAuto.pm----------------------
$Self->{'PostMaster::PreFilterModule::NewTicketReject::Body'} = 'Dear Customer,
unfortunately you have no valid ticket number
in your subject, so this email can\'t processed.
Please create a new ticket via the customer panel.
Thanks for your help!
Your Helpdesk Team
################ Kernel/Config/Files/ZZZAAuto.pm ###################
$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
};
$Self->{'PostMaster::PreFilterModule::NewTicketReject::Body'} = '
Dear Customer,
Unfortunately we could not detect a valid ticket number
in your subject, so this email can\'t be processed.
Please create a new ticket via the customer panel.
Thanks for your help!
Your Helpdesk Team
';
$Self->{'PostMaster::PreFilterModule::NewTicketReject::Subject'} = 'Email Rejected';
###############################################################################
[root@xxx ~]# find /opt/otrs/Kernel/* | xargs grep -ir MatchDBSource
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm:$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm: 'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
/opt/otrs/Kernel/Config/Files/Ticket.xml: <ConfigItem Name="PostMaster::PreFilterModule###000-MatchDBSource" Required="1" Valid="1">
/opt/otrs/Kernel/Config/Files/Ticket.xml: <Item Key="Module">Kernel::System::PostMaster::Filter::MatchDBSource</Item>
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm:$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm: 'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
/opt/otrs/Kernel/Config/Files/Ticket.xml: <ConfigItem Name="PostMaster::PreFilterModule###000-MatchDBSource" Required="1" Valid="1">
/opt/otrs/Kernel/Config/Files/Ticket.xml: <Item Key="Module">Kernel::System::PostMaster::Filter::MatchDBSource</Item>
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm:$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm: 'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
/opt/otrs/Kernel/Config/Files/Ticket.xml: <ConfigItem Name="PostMaster::PreFilterModule###000-MatchDBSource" Required="1" Valid="1">
/opt/otrs/Kernel/Config/Files/Ticket.xml: <Item Key="Module">Kernel::System::PostMaster::Filter::MatchDBSource</Item>
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
###############################################################################
[root@xxx~]# cat /opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm
# --
# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
# Copyright (C) 2001-2013 xxx, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::System::PostMaster::Filter::MatchDBSource;
use strict;
use warnings;
use Kernel::System::PostMaster::Filter;
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
$Self->{Debug} = $Param{Debug} || 0;
# get needed objects
for (qw(ConfigObject LogObject DBObject ParserObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
$Self->{PostMasterFilter} = Kernel::System::PostMaster::Filter->new(%Param);
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# check needed stuff
for (qw(JobConfig GetParam)) {
if ( !$Param{$_} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
return;
}
}
# get all db filters
my %JobList = $Self->{PostMasterFilter}->FilterList();
for ( sort keys %JobList ) {
# get config options
my %Config = $Self->{PostMasterFilter}->FilterGet( Name => $_ );
my %Match;
my %Set;
if ( $Config{Match} ) {
%Match = %{ $Config{Match} };
}
if ( $Config{Set} ) {
%Set = %{ $Config{Set} };
}
my $StopAfterMatch = $Config{StopAfterMatch} || 0;
my $Prefix = '';
if ( $Config{Name} ) {
$Prefix = "Filter: '$Config{Name}' ";
}
# match 'Match => ???' stuff
my $Matched = '';
my $MatchedNot = 0;
for ( sort keys %Match ) {
# match only email addresses
if ( defined $Param{GetParam}->{$_} && $Match{$_} =~ /^EMAILADDRESS:(.*)$/ ) {
my $SearchEmail = $1;
my @EmailAddresses = $Self->{ParserObject}->SplitAddressLine(
Line => $Param{GetParam}->{$_},
);
my $LocalMatched;
for my $Recipients (@EmailAddresses) {
my $Email = $Self->{ParserObject}->GetEmailAddress( Email => $Recipients );
next if !$Email;
if ( $Email =~ /^$SearchEmail$/i ) {
$LocalMatched = $SearchEmail || 1;
if ( $Self->{Debug} > 1 ) {
$Self->{LogObject}->Log(
Priority => 'debug',
Message =>
"$Prefix'$Param{GetParam}->{$_}' =~ /$Match{$_}/i matched!",
);
}
last;
}
}
if ( !$LocalMatched ) {
$MatchedNot = 1;
}
else {
$Matched = $LocalMatched;
}
}
# match string
elsif ( defined $Param{GetParam}->{$_} && $Param{GetParam}->{$_} =~ /$Match{$_}/i ) {
# don't lose older match values if more than one header is
# used for matching.
if ($1) {
$Matched = $1;
}
else {
$Matched = $Matched || '1';
}
if ( $Self->{Debug} > 1 ) {
$Self->{LogObject}->Log(
Priority => 'debug',
Message => "$Prefix'$Param{GetParam}->{$_}' =~ /$Match{$_}/i matched!",
);
}
}
else {
$MatchedNot = 1;
if ( $Self->{Debug} > 1 ) {
$Self->{LogObject}->Log(
Priority => 'debug',
Message => "$Prefix'$Param{GetParam}->{$_}' =~ /$Match{$_}/i matched NOT!",
);
}
}
}
# should I ignore the incoming mail?
if ( $Matched && !$MatchedNot ) {
for ( sort keys %Set ) {
$Set{$_} =~ s/\[\*\*\*\]/$Matched/;
$Param{GetParam}->{$_} = $Set{$_};
$Self->{LogObject}->Log(
Priority => 'notice',
Message => $Prefix
. "Set param '$_' to '$Set{$_}' (Message-ID: $Param{GetParam}->{'Message-ID'}) ",
);
}
# stop after match
if ($StopAfterMatch) {
$Self->{LogObject}->Log(
Priority => 'notice',
Message => $Prefix
. "Stopped filter processing because of used 'StopAfterMatch' (Message-ID: $Param{GetParam}->{'Message-ID'}) ",
);
return 1;
}
}
}
return 1;
}
1;
>> Nein
----------------- Kernel/Config/Files/ZZZAuto.pm----------------------
$Self->{'PostMaster::PreFilterModule::NewTicketReject::Body'} = 'Dear Customer,
unfortunately you have no valid ticket number
in your subject, so this email can\'t processed.
Please create a new ticket via the customer panel.
Thanks for your help!
Your Helpdesk Team
################ Kernel/Config/Files/ZZZAAuto.pm ###################
$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
};
$Self->{'PostMaster::PreFilterModule::NewTicketReject::Body'} = '
Dear Customer,
Unfortunately we could not detect a valid ticket number
in your subject, so this email can\'t be processed.
Please create a new ticket via the customer panel.
Thanks for your help!
Your Helpdesk Team
';
$Self->{'PostMaster::PreFilterModule::NewTicketReject::Subject'} = 'Email Rejected';
###############################################################################
[root@xxx ~]# find /opt/otrs/Kernel/* | xargs grep -ir MatchDBSource
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm:$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm: 'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
/opt/otrs/Kernel/Config/Files/Ticket.xml: <ConfigItem Name="PostMaster::PreFilterModule###000-MatchDBSource" Required="1" Valid="1">
/opt/otrs/Kernel/Config/Files/Ticket.xml: <Item Key="Module">Kernel::System::PostMaster::Filter::MatchDBSource</Item>
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm:$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm: 'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
/opt/otrs/Kernel/Config/Files/Ticket.xml: <ConfigItem Name="PostMaster::PreFilterModule###000-MatchDBSource" Required="1" Valid="1">
/opt/otrs/Kernel/Config/Files/Ticket.xml: <Item Key="Module">Kernel::System::PostMaster::Filter::MatchDBSource</Item>
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm:$Self->{'PostMaster::PreFilterModule'}->{'000-MatchDBSource'} = {
/opt/otrs/Kernel/Config/Files/ZZZAAuto.pm: 'Module' => 'Kernel::System::PostMaster::Filter::MatchDBSource'
/opt/otrs/Kernel/Config/Files/Ticket.xml: <ConfigItem Name="PostMaster::PreFilterModule###000-MatchDBSource" Required="1" Valid="1">
/opt/otrs/Kernel/Config/Files/Ticket.xml: <Item Key="Module">Kernel::System::PostMaster::Filter::MatchDBSource</Item>
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
/opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm:package Kernel::System::PostMaster::Filter::MatchDBSource;
###############################################################################
[root@xxx~]# cat /opt/otrs/Kernel/System/PostMaster/Filter/MatchDBSource.pm
# --
# Kernel/System/PostMaster/Filter/MatchDBSource.pm - sub part of PostMaster.pm
# Copyright (C) 2001-2013 xxx, http://otrs.com/
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --
package Kernel::System::PostMaster::Filter::MatchDBSource;
use strict;
use warnings;
use Kernel::System::PostMaster::Filter;
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
$Self->{Debug} = $Param{Debug} || 0;
# get needed objects
for (qw(ConfigObject LogObject DBObject ParserObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
$Self->{PostMasterFilter} = Kernel::System::PostMaster::Filter->new(%Param);
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# check needed stuff
for (qw(JobConfig GetParam)) {
if ( !$Param{$_} ) {
$Self->{LogObject}->Log( Priority => 'error', Message => "Need $_!" );
return;
}
}
# get all db filters
my %JobList = $Self->{PostMasterFilter}->FilterList();
for ( sort keys %JobList ) {
# get config options
my %Config = $Self->{PostMasterFilter}->FilterGet( Name => $_ );
my %Match;
my %Set;
if ( $Config{Match} ) {
%Match = %{ $Config{Match} };
}
if ( $Config{Set} ) {
%Set = %{ $Config{Set} };
}
my $StopAfterMatch = $Config{StopAfterMatch} || 0;
my $Prefix = '';
if ( $Config{Name} ) {
$Prefix = "Filter: '$Config{Name}' ";
}
# match 'Match => ???' stuff
my $Matched = '';
my $MatchedNot = 0;
for ( sort keys %Match ) {
# match only email addresses
if ( defined $Param{GetParam}->{$_} && $Match{$_} =~ /^EMAILADDRESS:(.*)$/ ) {
my $SearchEmail = $1;
my @EmailAddresses = $Self->{ParserObject}->SplitAddressLine(
Line => $Param{GetParam}->{$_},
);
my $LocalMatched;
for my $Recipients (@EmailAddresses) {
my $Email = $Self->{ParserObject}->GetEmailAddress( Email => $Recipients );
next if !$Email;
if ( $Email =~ /^$SearchEmail$/i ) {
$LocalMatched = $SearchEmail || 1;
if ( $Self->{Debug} > 1 ) {
$Self->{LogObject}->Log(
Priority => 'debug',
Message =>
"$Prefix'$Param{GetParam}->{$_}' =~ /$Match{$_}/i matched!",
);
}
last;
}
}
if ( !$LocalMatched ) {
$MatchedNot = 1;
}
else {
$Matched = $LocalMatched;
}
}
# match string
elsif ( defined $Param{GetParam}->{$_} && $Param{GetParam}->{$_} =~ /$Match{$_}/i ) {
# don't lose older match values if more than one header is
# used for matching.
if ($1) {
$Matched = $1;
}
else {
$Matched = $Matched || '1';
}
if ( $Self->{Debug} > 1 ) {
$Self->{LogObject}->Log(
Priority => 'debug',
Message => "$Prefix'$Param{GetParam}->{$_}' =~ /$Match{$_}/i matched!",
);
}
}
else {
$MatchedNot = 1;
if ( $Self->{Debug} > 1 ) {
$Self->{LogObject}->Log(
Priority => 'debug',
Message => "$Prefix'$Param{GetParam}->{$_}' =~ /$Match{$_}/i matched NOT!",
);
}
}
}
# should I ignore the incoming mail?
if ( $Matched && !$MatchedNot ) {
for ( sort keys %Set ) {
$Set{$_} =~ s/\[\*\*\*\]/$Matched/;
$Param{GetParam}->{$_} = $Set{$_};
$Self->{LogObject}->Log(
Priority => 'notice',
Message => $Prefix
. "Set param '$_' to '$Set{$_}' (Message-ID: $Param{GetParam}->{'Message-ID'}) ",
);
}
# stop after match
if ($StopAfterMatch) {
$Self->{LogObject}->Log(
Priority => 'notice',
Message => $Prefix
. "Stopped filter processing because of used 'StopAfterMatch' (Message-ID: $Param{GetParam}->{'Message-ID'}) ",
);
return 1;
}
}
}
return 1;
}
1;
Re: automatisches Entfernen von Kürzeln im Betreff
was steht in der Sysconfig unter Ticket::SubjectRe?
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
"Testing": ((OTRS Community Edition)) and git Master
Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
Re: automatisches Entfernen von Kürzeln im Betreff
Ticket::SubjectRe
--> Re
Standardwert: Re
The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.
Joa steht einfach nur "Re" drin wie Standard
--> Re
Standardwert: Re
The text at the beginning of the subject in an email reply, e.g. RE, AW, or AS.
Joa steht einfach nur "Re" drin wie Standard