Hi,
I noticed, that AdminEmails are not mime encoded. Esp. sending german
Umlaute and Euro/Cent-Signs is not possible.
I did a little Cut'n'Paste from System/Ticket/SendArticle.pm
Now it should work.
The 'To: Handling is not really cute, but it works :-)
-- 
J�rg Friedrich
--- Kernel/Modules/AdminEmail.pm.orig   2004-04-06 18:11:13.000000000 +0200
+++ Kernel/Modules/AdminEmail.pm        2004-04-06 18:48:24.000000000 +0200
@@ -12,6 +12,9 @@
 package Kernel::Modules::AdminEmail;
 
 use strict;
+use MIME::Words qw(:all);
+use MIME::Entity;
+use Mail::Internet;
 
 use vars qw($VERSION);
 $VERSION = '$Revision: 1.12 $';
@@ -37,6 +40,8 @@
     }
 
     $Self->{SendmailObject} = Kernel::System::Email->new(%Param);
+    $Self->{FQDN} = $Self->{ConfigObject}->Get('FQDN');
+    $Self->{Organization} = $Self->{ConfigObject}->Get('Organization');
 
     return $Self;
 }
@@ -45,6 +50,7 @@
     my $Self = shift;
     my %Param = @_;
     my $Output = '';
+    my $Charset = $Param{Charset} || 'iso-8859-15';
     foreach (qw(From Subject Body Bcc GroupPermission)) {
         $Param{$_} = $Self->{ParamObject}->GetParam(Param => $_) || $Param{$_} || '';
     }
@@ -109,12 +115,70 @@
                 return $Output;
             }
         }
+
+       # --
+       # prepare mail
+       # --
+
+       # --
+       # clean up
+       # --
+       $Param{Body} =~ s/(\r\n|\n\r)/\n/g;
+       $Param{Body} =~ s/\r/\n/g;
+
+       # --
+       # setting "To:"-Header to someting to prevent "To: undisclosed-recipients: ;"
+       # ATM setting it to From, which should be a valid Mailaddress
+       # --
+
+       $Param{To} = $Param{From};
+       
+       # --
+       # build mail ...
+       # --
+       # do some encode
+       foreach (qw(From To Bcc Subject)) {
+           if ($Param{$_}) {
+               $Param{$_} = encode_mimewords($Param{$_}, Charset => $Charset) || '';
+           }
+       }
+
+       # build header
+       my $Header = {
+           From => $Param{From},
+           To => $Param{To},
+           Bcc => $Param{Bcc},
+           Subject => $Param{Subject},
+           'X-Mailer' => "OTRS Mail Service ($VERSION)",
+           'X-Powered-By' => 'OTRS - Open Ticket Request System (http://otrs.org/)',
+           'Message-ID' => "<".time().".".rand(999999)."[EMAIL PROTECTED]>{FQDN}>",
+           Organization => $Self->{Organization},
+           Type => 'text/plain; charset='.$Charset,
+           Encoding => '8bit',
+       };
+
+       my $Entity = MIME::Entity->build(%{$Header}, Data => $Param{Body});
+
+       # --
+       # get header
+       # --
+       my $head = $Entity->head;
+
         # --
         # send mail
         # --
         $Output .= $Self->{LayoutObject}->Header(Area => 'Admin', Title => 
'Admin-Email');
         $Output .= $Self->{LayoutObject}->AdminNavigationBar();
-        if ($Self->{SendmailObject}->Send(%Param)) {
+       if ($Self->{SendmailObject}->Send(
+           From => $Param{From},
+           To => $Param{To},
+           Bcc => $Param{Bcc},
+           Subject => $Param{Subject},
+           Header => $head->as_string(),
+           Body => $Entity->body_as_string(),
+       )) {
+
+#        if ($Self->{SendmailObject}->Send(%Param)) {
             $Output .= $Self->_MaskSent(%Param);
         }
         else {
_______________________________________________
OTRS mailing list: dev - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/dev
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/dev

Reply via email to