Mail mit Attachment
Stephan
- cgi
Hallo,
nehmts mir nicht übel, dass ich wieder neu anfange, aber ich möchte halt vermeiden, dass das hier gleich im Archiv landet ... *g*
also ich habe jetzt folgende Datei zusammengebaut:
#!/usr/bin/perl
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.\n)*-->//g;
$FORM{$name} = $value;
}
# HTML-Datei wird geschrieben
open(NEWFILE,">http://ops/$FORM{'subject'}.html") die $!;
print NEWFILE "Content-type: text/html\n\n";
print NEWFILE "<html>\n";
print NEWFILE "<head>\n";
print NEWFILE "</head>\n";
print NEWFILE "<body>\n";
print NEWFILE "HTML-Attachment\n";
print NEWFILE "</body>\n";
print NEWFILE "</html>\n";
close(NEWFILE);
# Create a new multipart message:
$msg = new MIME::Lite
From =>'$FORM{'e-mail'}',
To =>'stephan.janz@gmx.de',
Cc =>'',
Subject =>'$FORM{'subject'}',
Type =>'multipart/mixed';
# Add parts (each "attach" has same arguments as "new"):
attach $msg
Type =>'TEXT',
Data =>"$FORM{'text'}";
attach $msg
Type =>'text/html',
Path =>'$FORM{'subject'}.html',
Filename =>'$FORM{'subject'}.html';
# Format as a string:
$str = $msg->as\_string;
# Print to a filehandle (say, a "sendmail" stream):
$msg->print(\\*SENDMAIL);
# Send in the "best" way (the default is to use "sendmail"):
$msg->send;
kann mir jemand sagen, wie das löschen geht
hat schon jemand fehler gefunden?
wie kann ich feststellen, ob in meinem SuSE (und bald RedHat *g*) MIME::Lite installiert ist?