Hi,
hab mir nen mailer mit daten versandt zusammen geschmissen :)
naja wie nicht anders zu erwarten funzt wieder etwas net...
((Die mails kommen an aber der anhang wird nicht mit gesendet:::
Fehlermeldung:
Warning: fopen("C:\EyeCandyLog.txt", "r") - Datei oder Verzeichnis nicht gefunden in /home/cliffdb6/www.cliffy.de/test/my.php on line 72
Warning: stat failed for C:\EyeCandyLog.txt (errno=2 - Datei oder Verzeichnis nicht gefunden) in /home/cliffdb6/www.cliffy.de/test/my.php on line 72
Warning: fread(): supplied argument is not a valid File-Handle resource in /home/cliffdb6/www.cliffy.de/test/my.php on line 72
Die Datein die er sucht sind vorhanden ;-)
Hier das Script in Action:
http://www.cliffy.de/test/my.php
Hat jemand eine erklärung für dieses verhalten?
Danke für eure Hilfe....
Hier das Script als anhang:
<?
Ausgabe von HTML
echo "
<!DOCtype html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DynamicWebPower :: Kundenbereich ::</title>";
include('inc/header.php');
echo "
</td>
</tr>
<tr>
<td valign="top">";
include('navlogin.php');
echo "
</td>
<td valign="top">
<table id="content" width="610" cellpadding="0" cellspacing="0" border="0">
<tr>
<td id="abstand" align="left" valign="top"><img src="../img/content_mailer.gif" width="258" height="13" alt="Vorwort..." /><p><br />Der Mailer hat den Vorteil das Sie Ihre E-mail an mich auch im HTML Format versenden können, dazu kommt das sie die Möglichkeit haben Datein als Anhang an mich zu Senden...</p></td>
</tr>
<tr>
<td valign="top" align="center">";
Type Auswahl für Select
$contenttypes = array(
"text/plain" => array("encoding"=>"8bit" ,"info"=>"purer Text"),
"text/html" => array("encoding"=>"8bit" ,"info"=>"HTML-Dokument"),
"image/gif" => array("encoding"=>"base64","info"=>"Bild: GIF"),
"image/jpeg" => array("encoding"=>"base64","info"=>"Bild: JPEG"),
"image/png" => array("encoding"=>"base64","info"=>"Bild: PNG"),
"application/x-zip-compressed" => array("encoding"=>"base64","info"=>"Komprimiert: ZIP"),
"application/x-gzip" => array("encoding"=>"base64","info"=>"Komprimiert: GZ"),
"application/x-tar" => array("encoding"=>"base64","info"=>"Komprimiert: TAR")
);
Variablen holen
$name=$_GET["name"];
$vorname=$_GET["vorname"];
$subject=$_GET["subject"];
$content_type=$_GET["content_type"];
$mail_content=$_GET["mail_content"];
$anhang=$_GET["anhang"];
$datei=$_GET["datei"];
$dateiname=$_GET["dateiname"];
$anhang_content_type=$_GET["anhang_content_type"];
$email=$_POST["email"];
echo "Anhang: $anhang\n\r$datei\n\r";
# Empfaenger festlegen
$an = "Silvermine@t-online.de";
# Inhalt?
if(isset($mail_content)) {
# Beginne den Mail-Header mit der Definition des Absenders
$mail_header = "From: $name, <$email>";
# Anhang ausgewaelt?
if($anhang == "ja" && isset($datei) && $datei != "") {
# Lese die temporaere Datei, die der Benutzer hochgeladen hat aus
$datei_content = fread(fopen($datei,"r"),filesize($datei));
# Codiere Datei ins BASE64-Format, falls noetig
if($contenttypes[$anhang_content_type][encoding]=="base64") $datei_content = chunk_split(base64_encode($datei_content));
else $datei_content = $datei_content;
# Erstelle Boundary
$boundary = strtoupper(md5(uniqid(time())));
# Beginne den Mailheader mit MIME-Mail-Header
$mail_header .= "\nMIME-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";
# Hier faengt der normale Mail-Text an
$mail_header .= "\n--$boundary";
$mail_header .= "\nContent-type: $content_type";
$mail_header .= "\nContent-Transfer-Encoding: 8bit";
$mail_header .= "\n\n$mail_content";
# Hier faengt der Dateianhang an
$mail_header .= "\n--$boundary";
$mail_header .= "\nContent-type: $anhang_content_type; name="$dateiname"";
# Lese aus dem Array $contenttypes die Codierung fuer den MIME-Typ des Anhangs aus
$mail_header .= "\nContent-Transfer-Encoding: ".$contenttypes[$anhang_content_type][encoding];
$mail_header .= "\nContent-Disposition: attachment; filename="$dateiname"";
$mail_header .= "\n\n$datei_content";
# Ende der eMail aus
$mail_header .= "\n--$boundary--";
} else {
$mail_header .= "\nContent-type: $content_type";
$mail_header .= "\nContent-Transfer-Encoding: 8bit";
$mail_header .= "\n\n".$mail_content;
}
# Sende eMail
if(@mail($an,$subject,"",$mail_header)) echo "<p><strong>Ihre E-mail wurde erfolgreich verandt</strong>";
else echo "<p><strong>Es ist ein Fehler beim senden der eMail aufgetreten.</strong></p>";
}
echo "
<form method="GET" enctype="multipart/form-data" action="my.php">
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left"><p>Name: </p></td>
</tr>
<tr>
<td align="left"><input type=text SIZE=25 name=vorname value="$row[vorname]"></td>
</tr>
<tr>
<td align="left"><p>Nachname: </p></td>
</tr>
<tr>
<td align="left"><input type=text SIZE=25 name=name value="$row[name]"></td>
</tr>
<tr>
<td align="left"><p>Email: </p></td>
</tr>
<tr>
<td align="left"><input type=text SIZE=25 name=name value="$row[email]"></td>
</tr>
<tr>
<td align="left"><p>Betreff: </p></td>
</tr>
<tr>
<td align="left"><input type=text SIZE=25 name=subject VALUE=""></td>
</tr>
<tr>
<td align="left"><p>Inhaltstyp: </p></td>
</tr>
<tr>
<td align="left"><SELECT NAME=content_type><OPTION VALUE="text/plain">Standard: Text<OPTION VALUE="text/html">HTML-Mail</SELECT></td>
</tr>
<tr>
<td align="left"><p>Nachricht: </p></td>
</tr>
<tr>
<td align="left"><textarea name="mail_content" cols="30" rows="6"></textarea></td>
</tr>
<tr>
<td align="left"><br /><p><input type=checkbox name=anhang value="ja">Anhang: </td>
</tr>
<tr>
<td align="left"><p>Datei: </p></td>
</tr>
<tr>
<td align="left"><input type=file SIZE=20 NAME=datei></td>
</tr>
<tr>
<td align="left"><p>Dateiname in Mail: </p></td>
</tr>
<tr>
<td align="left"><input type=text SIZE=20 NAME=dateiname value=""></td>
</tr>
<tr>
<td align="left"><p>Inhaltstyp: </p></td>
</tr>
<tr>
<td align="left"><SELECT NAME=anhang_content_type>";
/*
Lese aus dem Array $contenttypes mit den MIME-typen die Daten aus und
generiere eine Drop-Down-Liste
*/
reset($contenttypes);
$key=key($contenttypes);
while($key != "" || $key=="0") {
echo "<OPTION VALUE="$key">".$contenttypes[$key][info];
next($contenttypes);
$key=key($contenttypes);
}
echo "
</SELECT></td>
</tr>
<tr>
<td align="left"><br /><input type=submit VALUE="Abschicken">
<input type="hidden" name="logid" value="$logid">
<input type="hidden" name="passwort" value="$passwort">
<input type="reset" name="reset" value="Löschen" title="Löschen">
</td>
</tr>
</table>
</form>";
end mailer
echo "
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center">";
include('../inc/footer.inc');
echo "
</td>
</tr>
</table>
</div>
</body>
</html>";
?>