Hallo,
hier mal ein einfaches Beispiel zum eMail Versand mit Anlagen. Ich bin derzeit dabei, es ein wenig auszubauen und formulartauglich zu machen .(getestet mit Outlook Express v5.0).
$mimeprog # ist von Server zu Server verschieden
$recipient # Adresse des Empfängers
$attachedFile # Pfad und Name der Datei
$attachedName # Name der Anlage
#! /usr/bin/perl
#######################################################
sendfile.cgi #
Autor: Ralf Neumann [City-Shop Golßen] #
eMail: cityshop@webset.de
#######################################################
$mimeprog = '/usr/bin/mimencode';
$mailprog = '/usr/lib/sendmail';
$recipient = 'cityshop@webset.de';
$attachedFile = "image.jpg";
$attachedName = "image.jpg";
$boundary = "----=_NextPart";
########################################################
Datei encodieren
########################################################
@attachedFile = $mimeprog $attachedFile $attachedName;
########################################################
Mailversand #
########################################################
&mailIt;
sub mailIt
{
open (MAIL, "|$mailprog $recipient") || die "Fehler beim Öffnen: $mailprog!\n";
print MAIL "Subject: Sendfile-Test\n";
print MAIL "Content-Type: multipart/mixed;\n";
print MAIL " boundary="$boundary"\n\n";
print MAIL "--$boundary\n";
print MAIL "Content-Type: text/plain\n";
print MAIL " charset="iso-8859-1"\n";
print MAIL "Content-Transfer-Encoding: 7bit\n\n";
print MAIL "Anlagen: $attachedName\n\n";
print MAIL "--$boundary\n";
print MAIL "Content-Type: image/jpeg\n";
print MAIL " name="$attachedName"\n";
print MAIL "Content-Transfer-Encoding: base64\n";
print MAIL "Content-Disposition: attachment;\n";
print MAIL " filename="$attachedName"\n\n";
print MAIL @attachedFile;
print MAIL "\n\n";
close MAIL;
}
mfg
Ralf Neumann