
Hallo! Ich möchte gerne verschiedene, angepasste Formulare zum Absetzen von Meldungen konfigurieren. Ich habe dazu die webform.pl entsprechend kopiert und angepasst. Das Ausfüllen der Formule funktioniert wunderbar, es wird auch die Bestätigung nach "Absenden" angezeigt, nur kommt im OTRS keine eMail an :-( Ich habe die procmailrc lt. Handbuch getestet, das funktioniert. Auch das original webform.pl funktioniert nicht. Die eMail-Adressen habe ich im .pl-File auch angepasst. Ich habe schon vermutet, dass es daran liegen könnte, dass in der config eine Weiterleitung an meinen eMail- Server eingetragen ist... Any ideas? Gruss Guenther Hier meine .pl use strict; # to get the errors on screen use CGI::Carp qw(fatalsToBrowser); # Simple Common Gateway Interface Class use CGI; my $VERSION = '$Revision: 1.3 $'; $VERSION =~ s/^\$.*:\W(.*)\W.+?$/$1/; # -- # web form options # -- my $Ident = 'ahfiw2Fw32r230dddl2foeo3r'; # sendmail location and options my $Sendmail = '/usr/sbin/sendmail -t -i -f '; # email where the emails of the form will send to my $OTRSEmail = 'otrs@localhost'; # topics and dest. queues my %Topics = ( # topic => OTRS queue 'Haustechnik' => 'Haustechnik', ); # -- # html header # -- sub Header { my %Param = @_; (my $Output = <<EOF); Content-Type: text/html <html> <head> <title>$Param{"Title"}</title> </head> <body> <h1>$Param{"Title"}</h1> <hr> EOF return $Output; } # -- # html footer # -- sub Footer { (my $Output = <<EOF); <hr> </body> </html> EOF return $Output; } # -- # Thanks # -- sub Thanks { my %Param = @_; (my $Output = <<EOF); Danke <b>$Param{From}</b>! Ihre Anfrage wurde an uns gesendet. <br> Wir werden Ihre Anfrage baldmöglichst bearbeiten.<br> EOF return $Output; } # -- # error # -- sub Error { my %Param = @_; (my $Output = <<EOF); <font color="red">$Param{Message}</font><br> EOF return $Output; } # -- # start the real actions # -- my $CGI = new CGI; my %GetParam = (); foreach (qw(Action From FromEmail Topic Raum Tel Wo Was)) { $GetParam{$_} = $CGI->param($_) || ''; } # what should I do? if ($GetParam{Action} eq 'SendMail') { SendMail(%GetParam); } else { WebForm(); } # -- # web form # -- sub WebForm { print Header(Title => 'Reparaturanforderung'); print ' <form action="hbtform.pl" method="post"> <input type="hidden" name="Action" value="SendMail"> <table> <tr> <td>An:</td> <td> '; foreach (sort keys %Topics) { print $_.'<input type="radio" name="Topic" value="'.$Topics{$_}.'">'; } print ' </td> </tr> <tr> <td>Von:</td> <td><input type="text" name="From" size="25" value=""></td> </tr> <tr> <td>Email:</td> <td><input type="text" name="FromEmail" size="25" value=""></td> </tr> <tr> <td>Telefon:</td> <td><input type="text" name="Tel" size="5" value=""></td> <td>Raum-Nr.:</td> <td><input type="text" name="Raum" size="8" value=""></td> </tr> <tr> <td>Wo?</td> <td><input type="text" name="Wo" size="25" value=""></td> </tr> <tr> <td>Was?</td> <td><input type="text" name="Was" size="25" value=""></td> </tr> <tr> <td></td> <td><input type="submit" value="Absenden"></td> </tr> </table> </form> '; print Footer(); } # -- # send email # -- sub SendMail { my %Param = @_; my $Output = ''; # -- # check needed params # -- foreach (qw(From FromEmail Topic Tel Raum Wo Was)) { if (!$Param{$_}) { $Output .= Error(Message => "Param $_ is needed!"); } } if ($Output) { $Output = Header(Title => 'Error!') . $Output; $Output .= Footer(); print $Output; return; } # -- # simple email check # --- if ($Param{FromEmail} !~ /.+?\@.+?\..+?/) { $Output = Header(Title => 'Error!'); $Output .= Error(Message => "Your email '$Param{FromEmail}' is invalid!"); $Output .= Footer(); print $Output; return; } # -- # build email # -- my @Mail = ("From: $Param{From} <$Param{FromEmail}>\n"); push @Mail, "To: $Param{Topic} <$OTRSEmail>\n"; push @Mail, "Subject: $Param{Was}\n"; push @Mail, "X-OTRS-Ident: $Ident\n"; push @Mail, "X-OTRS-Queue: $Param{Topic}\n"; push @Mail, "X-OTRS-ArticleKey1: Sent via\n"; push @Mail, "X-OTRS-ArticleValue1: Webform\n"; push @Mail, "X-OTRS-ArticleKey2: Orig. sort\n"; push @Mail, "X-OTRS-ArticleValue2: $Param{Topic}\n"; push @Mail, "X-Mailer: OTRS WebForm ($VERSION)\n"; push @Mail, "X-Powered-By: OTRS (http://otrs.org/)\n"; push @Mail, "\n"; push @Mail, $Param{Was}; push @Mail, "\n"; # -- # send mail # -- $Param{From} =~ s/"|;|'|<|>|\|| //ig; if (open(MAIL, "|$Sendmail $Param{From} ")) { print MAIL @Mail; close(MAIL); # -- # thanks! # -- $Output = Header(Title => 'Danke für Ihre Anfrage!'); $Output .= Thanks(%Param); $Output .= Footer(); print $Output; } else { # error $Output = Header(Title => 'Fehler!'); $Output .= Error(Message => "Can't send email: $!"); $Output .= Footer(); print $Output; } } # --