Reiner: Mailform mit Fileattachment

Beitrag lesen

Vielleicht kann mir ja einer helfen.

Gruß

Oliver

Gerne!

Alles Gute,
Reiner

---------------------------------------------------------

#!/usr/bin/perl

$recipient = 'reiner.rusch@ctrl-de.de';
$attachedFile = "daten.zip";

&mailIt;

print "Content-type: text/html\n\n";
print <<ENDE;
<html>
<body>
Vielen Dank für Ihre Mühe!
</body></html>

ENDE
########################################################
sub mailIt
{
use MIME::Lite;

$mailprog = '/usr/lib/sendmail';

$object = MIME::Lite->new(
    From        =>'SERVER',
    To          =>"$recipient",
    Subject     =>'aktuelle AKZ-Tabelle',
    Type        =>'application/x-tar',
    Encoding    =>'base64',
    Path        =>"$attachedFile");

open (MAIL, "$mailprog $recipient") die "Fehler beim Öffnen: $mailprog!\n";
  $object->print (\*MAIL);
  close MAIL;
}