foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; if ($allow_html != 1) { $value =~ s/<([^>]|\n)*>//g; } $FORM{$name} = $value; if ($name ne 'Submit') { print FILE $name; print FILE "="; print FILE $value; print FILE "\n"; print HTMLFILE "\n"; print HTMLFILE ""; print HTMLFILE $name; print HTMLFILE "\n"; print HTMLFILE ""; print HTMLFILE $value; print HTMLFILE "\n"; print HTMLFILE "\n"; } } print HTMLFILE ""; print HTMLFILE ""; print HTMLFILE ""; close (FILE); close (HTMLFILE); my $emaillinks; my $emailrechts; ($emaillinks, $emailrechts) = split(/@/, $email); $cc_address = $emaillinks."\@".$emailrechts; print "Content-type: text/html\n\n"; print "

\n"; print "

Blablabla\n"; #Email variables. $mail_server = "xxx"; $from_address = "xxx"; $to_address = $TmpEmailAddressto; $subject = $lastname." ".$firstname." xxx"; $body = "body"; $mimeType = "text/html"; $message_body = "

Absender: ".$lastname." ".$firstname." ".$ValA."

"; MIME::Lite->send("smtp", $mail_server); # Create the initial text of the message $mime_msg = MIME::Lite->new( From => $from_address, To => $to_address, Cc => $cc_address, Subject => $subject, Type => $mimeType, Data => $message_body ) or die "Error creating MIME body: $!\n"; $mime_msg->attach( Type => "text/html", Disposition => "attachment", Path => $htmlfilename, Filename => $htmlfilename, ); $mime_msg->send();