Kristofer Wolff wrote:
>
> Hi all,
>
> im generating a mail with n elements. The first element is always a
> text/plain part, and the follwoings ar attached.
>
> here is the codeblock:
> ----------------------------------------------------------------------------
> --------------------
> sub senden
> {
> ($nick, $To, $Cc, $Bcc, $Subject, $body, $attached) = @_;
> $msg =~ s/\r//g;
> @msg = split(/\n/, $msg);
> # ataached
> @attachedfiles = split(/;/, $attached);
>
> $msg =
> E::Lite->new(
> From =>"$nick",
> To =>"$To",
> Cc =>"$Cc",
> Bcc
>=>"$Bcc",
> Subject =>"$Subject",
> Type =>'multipart/mixed'
> );
>
> $msg->attach(Type =>'TEXT',
> Data =>"$body"
> );
>
> foreach $at(@attachedfiles)
> {
> ($name, $suf) = split(/\./, $at);
> if($suf eq "gif")
> {
> $msg->attach( Type =>'image/gif',
> Path =>"$s_dir/$nick/append/$at",
> Filename =>"$at"
> );
> }
> elsif($suf eq "jpg")
> {
> $msg->attach( Type =>'image/jpeg',
> Path =>"$s_dir/$nick/append/$at",
> Filename =>"$at"
> );
> }
> elsif($suf eq "html")
> {
> $msg->attach( Type =>'text/html',
> Path =>"$s_dir/$nick/append/$at",
> Filename =>"$at"
> );
> }
> elsif($suf eq "htm")
> {
> $msg->attach( Type =>'text/html',
> Path =>"$s_dir/$nick/append/$at",
> Filename =>"$at"
> );
> }
> elsif($suf eq "txt")
> {
> $msg->attach( Type =>'text/plain',
> Path =>"$s_dir/$nick/append/$at",
> Filename =>"$at"
> );
> }
> else
> {
> $msg->attach( Type =>'APLICATION',
> Path =>"$s_dir/$nick/append/$at",
> Filename =>"$at"
> );
> }
> }
>
> MIME::Lite->send('smtp', "localhost");
> $msg->send;
>
> # kill attached !
> foreach $at(@attachedfiles)
> {
> unlink("$s_dir/$nick/append/$at");
> }
> print "Content-type: text/html\n\n";
> print "<script Language=\"javascript\">\n";
> print " alert(\"Mail wurde versand\");\n";
> print " window.close();\n";
> print "</script>\n";
> exit;
> }
> ------------------------------------------
> if I sending a mail to my Outlook account, with a text (firstpart) and a Atached
>html file, the html shown in my mail and the text is as Attachment !
>
> Its Upside-down !
>
> Why ?
> Can I controll the Stack ?
This renders fine in Netscape (don't know about Outlook):
use strict;
use MIME::Lite;
&senden ('[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '', '', 'Subject', "body\nbody\n",
'a.gif;b.gif');
sub senden {
my ($nick, $To, $Cc, $Bcc, $Subject, $body, $attached) = @_;
#my $msg =~ s/\r//g; # what's this
#my @msg = split /\n/, $msg; # and this
my @attachedfiles = split /;/, $attached;
my $msg = MIME::Lite->new(From => $nick, To => $To, Cc => $Cc, Bcc => $Bcc,
Subject => $Subject, Type => 'multipart/mixed');
$msg->attach(Type =>'TEXT', Data => $body);
foreach my $at (@attachedfiles) {
my ($name, $suf) = split /\./, $at;
if ($suf eq 'gif') {
$msg->attach(Type => 'image/gif',
Path => "$s_dir/$nick/append/$at", Filename => $at);
} elsif ($suf eq 'jpg') {
$msg->attach(Type => 'image/jpeg',
Path => "$s_dir/$nick/append/$at", Filename => $at);
} elsif ($suf eq 'html') {
$msg->attach(Type => 'text/html',
Path => "$s_dir/$nick/append/$at", Filename => $at);
} elsif ($suf eq 'htm') {
$msg->attach(Type => 'text/html',
Path => "$s_dir/$nick/append/$at", Filename => $at);
} elsif ($suf eq 'txt') {
$msg->attach(Type => 'text/plain',
Path => "$s_dir/$nick/append/$at", Filename => $at);
} else {
$msg->attach(Type => 'APLICATION',
Path => "$s_dir/$nick/append/$at", Filename => $at);
}
}
MIME::Lite->send('smtp', 'mail.yourdomain.com'); # put smtp host in here
$msg->send;
# kill attached !
foreach my $at (@attachedfiles) {
unlink ("$s_dir/$nick/append/$at");
}
print "Content-type: text/html\n\n";
print "<script Language=\"javascript\">\n";
print " alert(\"Mail wurde versand\");\n";
print " window.close();\n";
print "</script>\n";
exit;
}
__END__
--
,-/- __ _ _ $Bill Luebkert ICQ=14439852
(_/ / ) // // DBE Collectibles http://www.todbe.com/
/ ) /--< o // // Mailto:[EMAIL PROTECTED] http://dbecoll.webjump.com/
-/-' /___/_<_</_</_ http://www.freeyellow.com/members/dbecoll/
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web