Auszug aus <otrs-home>/Kernel/Config/GenericAgent.pm
Code: Select all
%Jobs = (
'Email auf Ticket 21000120 senden' => {
TicketNumber => '%21000120%',
New => {
Module => 'Kernel::System::GenericAgent::NotifyEmail',
},
},
);
<otrs-home>/Kernel/System/GenericAgent/NotifyEmail.pm
Code: Select all
# --
# Kernel/System/GenericAgent/NotifyEmail.pm - generic agent email sending
# based on Kernel/System/GenericAgent/NotifyAgentGroupOfCustomQueue.pm from xxx
# --
# $Id: NotifyEmail.pm,v 0.1 2008/09/30 11:37
# --
# 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-2.0.txt.
# --
package Kernel::System::GenericAgent::NotifyEmail;
use strict;
use warnings;
use Kernel::System::User;
use Kernel::System::Email;
use Kernel::System::Queue;
use vars qw(@ISA $VERSION);
$VERSION = qw($Revision: 1.17 $) [1];
sub new {
my ( $Type, %Param ) = @_;
# allocate new hash for object
my $Self = {};
bless( $Self, $Type );
# check needed objects
for (qw(DBObject ConfigObject LogObject TicketObject TimeObject)) {
$Self->{$_} = $Param{$_} || die "Got no $_!";
}
# 0=off; 1=on;
$Self->{Debug} = $Param{Debug} || 0;
$Self->{UserObject} = Kernel::System::User->new(%Param);
$Self->{EmailObject} = Kernel::System::Email->new(%Param);
$Self->{QueueObject} = Kernel::System::Queue->new(%Param);
return $Self;
}
sub Run {
my ( $Self, %Param ) = @_;
# get ticket data
my %Ticket = $Self->{TicketObject}->TicketGet(%Param);
# bis hier Teile von NotifyAgentGroupOfCustomQueue.pm,v 0.1 2008/09/30 11:37
############################################################################
# ab hier selbst zusammen gesucht
# in dem Array %Ticket stecken alle Infos über das aktuelle Ticket, die über TicketGet()
# geladen werden können
#
# Body => 'Die Ticketnummer lautet: '.$Ticket{TicketNumber},
#
# (TicketNumber, TicketID, State, StateID, StateType, Priority, PriorityID, Lock, LockID,
# Queue, QueueID, CustomerID, CustomerUserID, Owner, OwnerID, Type, TypeID, SLA, SLAID,
# Service, ServiceID, Responsible, ResponsibleID, Created, Changed, TicketFreeKey1-16,
# TicketFreeText1-16, TicketFreeTime1-6, ...)
#
# Weitere Infos um z.B. Anhänge an die Mails zu packen:
# http://dev.otrs.org/cvs/Kernel/System/Email.html bei Send()
$Self->{EmailObject}->Send(
From => 'me@example.com',
To => 'friend@example.com',
Charset => 'utf-8',
Subject => 'Some words!',
Type => 'text/plain',
Body => 'Some nice text',
);
return 1;
}
1;
Code: Select all
/opt/otrs/bin/GenericAgent.pl -c Kernel::Config::GenericAgentNotifyEmail