Hallo Leute
Kann mir jemand sagen wie ich ein Attechment mit dem Sendmail versenden kann.
Danke und Gruss
Mayas
Kann mir jemand sagen wie ich ein Attechment mit dem Sendmail versenden kann.
Danke und Gruss
Mayas
open (SENDMAIL, "|/usr/lib/sendmail -oi -t -odq") or die "Kann sendmail nicht fork()-en: $!\n; print SENDMAIL <<"EOF"; From: Absender <mein\@mail.ch> To: Empfaenger <dein\@mail.ch> Subject: Logfile vom Backup nachsehen ==>Attachement: <pfad> Der eigentliche Text kommt hierhin Und noch eine Zeile wenn man will. EOF close (SENDMAIL) or warn "Pipe zu Sendmail unsanft beendet";
# You may not need to change the $mailprog variable. # Try it as is first. If it doesn't work try putting a # in # front of the first line below and remove the # on the # second line. If that fails, try the removing the # on # the third line and put a # in front of the other two. # If that fails, ask your administrator where the sendmail # program is on your system. $mailprogram = '/usr/sbin/sendmail'; # $mailprogram = 'usr/lib/sendmail'; # $mailprogram = '/usr/bin/sendmail'; # Enter the e-mail address where you want to receive # the messages from your visitors. # Depending on the version of PERL you are using, you should # be able to just use your straight e-mail address. If # not you MAY have to escape the @ with a \ like this # you\@youremail.com $myemail = 'you@youremail.com'; # Send e-mail to you open (MAIL,"|$mailprogram -t"); print MAIL "To: $myemail\n"; print MAIL "From: $sender\n"; print MAIL "Subject: $subject\n"; print MAIL "Message from $username\n\n"; print MAIL "$message\n\n"; close(MAIL);
$boundary = strtoupper(md5(uniqid(time())));
$mail_header = "From:$from(Sales)\n";
$mail_header .= "MIME-Version: 1.0";
$mail_header .= "\nContent-Type: multipart/mixed; boundary=$boundary";
$mail_header .= "\n\nThis is a multi-part message in MIME format -- Dies ist eine mehrteilige Nachricht im MIME-Format";
$mail_header .= "\n--$boundary";
$mail_header .= "\nContent-Type: text/plain";
$mail_header .= "\nContent-Transfer-Encoding: 8bit";
$mail_header .= "\n\n$message";
$file_content = fread(fopen($file,"r"),filesize($file));
$file_content = chunk_split(base64_encode($file_content));
$mail_header .= "\n--$boundary";
$mail_header .= "\nContent-Type: application/octetstream; name=\"$file_name\"";
$mail_header .= "\nContent-Transfer-Encoding: base64";
$mail_header .= "\nContent-Disposition: attachment; filename=\"$file_name\"";
$mail_header .= "\n\n$file_content";
$mail_header .= "\n--$boundary--";
OffTopic:
Nur weil ich heute gute Laune habe.
Kommentar