Hallo zusammen und ein frohes neues Jahr:
Ich habe folgendes Problem.
Jedesmal wenn ich mit diesem Script eine Email abschicke,
so erhalte ich zwei Attachments.
einmal die gewünschte datei und einmal ein File mit dem Namen
ATT00001 ohne Endung, welches leer ist.
Wo kommt diese datei her??
-->
function attachment_mail($to, $from, $subject, $message, $file)
{
$mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1));
$data = chunk_split(base64_encode(implode("", file($file))));
$header = "From: " . $from . "\r\n";
$header.= "To: " . $to . "\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: multipart/mixed;\r\n";
$header.= " boundary=\"" . $mime_boundary . "\"\r\n";
		    
$content = "This is a multi-part message in MIME format.\r\n\r\n";
$content.= "--".$mime_boundary."\r\n";
$content.= "Content-Type: text/plain; charset=\"uft-8\"\r\n";
$content.= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$content.= $message . "\r\n";
$content.= "--".$mime_boundary."\r\n";
$content.= "Content-Disposition: attachment;\r\n";
$content.= "Content-Type: Application/Octet-Stream; name=\"".$file."\"\r\n";
$content.= "Content-Transfer-Encoding: base64\r\n\r\n";
$content.= $data."\r\n";
$content.= "--" . $mime_boundary . "\r\n";
if(mail($to, $subject, $content, $header))
{
return true;
}
else
{
return false;
}
}
$empfaenger = 'mail@domian.com';
$absender = 'mail@domian.com';
$betreff = "Mail mit Dateianhang";
$file = "test.txt";
$text = "Email mit dateianhang";
// eMail verschicken
if(attachment_mail($empfaenger, $absender, $betreff, $text, $file ) == true)
{
echo "Email wurde verschickt";
}
else
{
echo "Email wurde nicht verschickt";
}
<--
Danke für Eure Hilfe
Sol
					Ich habe folgendes Problem.
Jedesmal wenn ich mit diesem Script eine Email abschicke,
so erhalte ich zwei Attachments.
einmal die gewünschte datei und einmal ein File mit dem Namen
ATT00001 ohne Endung, welches leer ist.
Wo kommt diese datei her??
-->
function attachment_mail($to, $from, $subject, $message, $file)
{
$mime_boundary = "<<<:" . md5(uniqid(mt_rand(), 1));
$data = chunk_split(base64_encode(implode("", file($file))));
$header = "From: " . $from . "\r\n";
$header.= "To: " . $to . "\r\n";
$header.= "MIME-Version: 1.0\r\n";
$header.= "Content-Type: multipart/mixed;\r\n";
$header.= " boundary=\"" . $mime_boundary . "\"\r\n";
$content = "This is a multi-part message in MIME format.\r\n\r\n";
$content.= "--".$mime_boundary."\r\n";
$content.= "Content-Type: text/plain; charset=\"uft-8\"\r\n";
$content.= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$content.= $message . "\r\n";
$content.= "--".$mime_boundary."\r\n";
$content.= "Content-Disposition: attachment;\r\n";
$content.= "Content-Type: Application/Octet-Stream; name=\"".$file."\"\r\n";
$content.= "Content-Transfer-Encoding: base64\r\n\r\n";
$content.= $data."\r\n";
$content.= "--" . $mime_boundary . "\r\n";
if(mail($to, $subject, $content, $header))
{
return true;
}
else
{
return false;
}
}
$empfaenger = 'mail@domian.com';
$absender = 'mail@domian.com';
$betreff = "Mail mit Dateianhang";
$file = "test.txt";
$text = "Email mit dateianhang";
// eMail verschicken
if(attachment_mail($empfaenger, $absender, $betreff, $text, $file ) == true)
{
echo "Email wurde verschickt";
}
else
{
echo "Email wurde nicht verschickt";
}
<--
Danke für Eure Hilfe
Sol
          
 Moderator
							
						
Kommentar