![]() |
|< 1 2 3 >| | ![]() |
23 Einträge, 3 Seiten |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
#!C:/Program Files/Perl/bin/perl use strict; use warnings; use CGI; use CGI::Carp qw(fatalsToBrowser); use Net::SMTP; use MIME::Lite; print CGI::header(); my $Label; my $TmpAdressTo; my $TmpEmailAddressTo; my $allow_html = 0; my %FORM = CGI::Vars(); my $firstname = $FORM{firstname}; my $lastname = $FORM{lastname}; my $email = $FORM{email}; my $ValA = $FORM{valA}; unless( $firstname and $lastname and $FORM{valA} and $email ){ print "Blabla!<br><br>\n\nBlabla!"; stop(); } my $filename = "exercises/".$firstname."_".$lastname."_".time().".txt"; my $htmlfile = $filename . '.html'; open my $fh_file, '>', $filename or die "$filename: $!"; open my $fh_html, '>', $htmlfile or die "$htmlfile: $!"; print $fh_html qq~<html><body><table bgColor="#ffcc66" border="1" width="80%" align="center">~; if( $allow_html != 1 ){ for my $key ( keys %FORM ){ $FORM{$key} =~ s/<([^>]|\n)*>//g; } } while( my ($key,$value) = each %FORM ){ next if( $key eq 'Submit' ); print $fh_file $key, "=", $value, "\n"; print $fh_html"<tr>\n<td>$key</td>\n<td>$value</td>\n<tr>\n"; } print "<br><br><CENTER>\n<h2>Blablabla\n"; my $mail_server = "xxx"; my $from_address = "xxx"; my $to_address = $TmpEmailAddressto; my $subject = $lastname." ".$firstname." xxx"; my $body = "body"; my $mimeType = "text/html"; my $message_body = "<HTML><BODY><CENTER><h2>Absender: ".$lastname." ".$firstname." ".$ValA."</H2></CENTER></BODY></HTML>"; MIME::Lite->send("smtp", $mail_server); # Create the initial text of the message my $mime_msg = MIME::Lite->new( From => $from_address, To => $to_address, Cc => $email, Subject => $subject, Type => $mimeType, Data => $message_body ) or die "Error creating MIME body: $!\n"; $mime_msg->attach( Type => "text/html", Disposition => "attachment", Path => $htmlfile, Filename => $htmlfile, ); $mime_msg->send(); sub stop{ # mach was }
![]() |
|< 1 2 3 >| | ![]() |
23 Einträge, 3 Seiten |