Jump to content

php mail bzw mime mail


Recommended Posts

hallo,


möchte gerne eine email mit anhang verschicken.


so sieht derzeit mein script aus:

// create a boundary
$boundary = "-" . time();
//$boundary .= $$; // didn't dig $$ equivalent in PHP ( process-id )
$boundary .= "xoxoxoxoxo";
$boundary .= time() . "-";

$charset = "iso-8859-1";

//load the attachment from disk
$attach_file_name = "c://inetpub//wwwroot//vog//portal//neukunde//$datei.txt";
$handle = fopen($attach_file_name, "r");
$attach_content = fread($handle, filesize($attach_file_name));
$dateiname = "$datei.txt";
fclose($handle);

$themessage = "Dies ist eine Ersatzteilanfrag von $fullname. Die dazugehörige Datei mit den daten finden Sie im Anhang oder unter $attach_file_name";

$to = "jh@fcs.de";
$subject = "Ersatzteilanfrage Neukunde";
$xtra = "From: $email (Absender)\n";
$xtra .= "X-Mailer: PHP ". phpversion() . "\n";
$xtra .= "MIME-Version: 1.0\n";
$xtra .= "Content-Transfer-Encoding: 8bit\n";
$xtra .= "Content-Type: multipart/mixed; boundary=\"". $boundary . "\"\n\n";
$xtra .= "--" . $boundary . "\n";
$xtra .= "Content-Type: text/plain; charset=\"" . $charset . "\"\n";
$xtra .= "Content-Transfer-Encoding: 7bit";

$message = $themessage . "\n\n";
$message .= "--" . $boundary . "\n";
$message .= "Content-Type: image/png; name=\"" . $dateiname . "\"\n";
$message .= "Content-Transfer-Encoding: base64\n";
$message .= "Content-Disposition: attachment; filename=\"" . $dateiname . "\"\n\n";

//encode the attachment with BASE64
$attach = chunk_split(base64_encode($attach_content));
$message .= $attach;
$message .= "\n--" . $boundary . "--\n";

mail($to, $subject, $message, $xtra);



klappt auch alles bis auf den body in der email der eigentlich aus $themessage bestehen solle. leider steht nichts in der email. betreff anahang etc sind korrekt..


woran könnte das liegen?


gruß

jan

Link to post
Share on other sites

hmm also mein smtp header sieht so aus

Received: from w2kweb01 [192.168.5.3] by Tradepark with DvISE PostMan (0224.43464B4D4A464D494D4C);
13 Sep 2005 12:19:44 UT
Date: Tue, 13 Sep 2005 14:19:44 +0100
Subject: Ersatzteilanfrage Neukunde
To: jh@fcs.de
From:       
X-Mailer: PHP 4.3.8
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: multipart/mixed; boundary="-1126613984xoxoxoxoxo1126613984-"
---1126613984xoxoxoxoxo1126613984-
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit



bei html inhalt steht nichts. wo bei "normalen" mails dann ja der html code des maintextes kommen sollte.

Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...