Hallo,
ich habe mir die HTML Mime mail class runtergeladen um txt-Dateianhänge per Email zu verschicken.
Nun möchte ich mehrere Dateien mit der Klasse in einer E-Mail verschicken. Jedoch funktioniert das nicht.
Hier der Code, wenn jeder Anhang einzelnd verschickt wird. Das funktioniert wunderbar!!!
PHP-Code:
error_reporting(E_ALL);
include('htmlMimeMail.php');
...............
................
................
$result_plz = mysql_query($plz_sql) OR die(mysql_error());
while($row_plzgesamt = mysql_fetch_array($result_plz))
{
................
$result_mailing = mysql_query($mailing_sql) OR die(mysql_error());
while($row_mailing = mysql_fetch_array($result_mailing))
{
if($row_mailing['sammel']==0)
{
$sammeln = "";
} else
{
$sammeln = "/sammel";
}
$ordner = date("Y_m_d",time());
$file_name = $ordner."/".$row_mailing['dplz']."".$sammeln."/".$row_mailing['data_name'].".txt";
echo("
".$file_name);
$file = $row_mailing['data_name'].".txt";
$mail = new htmlMimeMail();
$attachment = $mail->getFile($file_name);
$mail->addAttachment($attachment, $file, 'text/plain');
$text = "PLZ-Bereich:".$row_plzgesamt['gesamtplz'];
$mail->setText($text);
$mail->setFrom('rechnung@wirbringenes.de');
$result = $mail->send(array($row_mailing['email']));
echo $result ? 'Mail sent!' : 'Failed to send mail';
}
}
mysql_close();
Und hier der Code, wenn ich alles in einer E-Mail verschicken möchte:
PHP-Code:
error_reporting(E_ALL);
include('htmlMimeMail.php');
...................
....................
..................
$result_plz = mysql_query($plz_sql) OR die(mysql_error());
while($row_plzgesamt = mysql_fetch_array($result_plz))
{
.....................
$result_mailing = mysql_query($mailing_sql) OR die(mysql_error());
$mail = new htmlMimeMail();
while($row_mailing = mysql_fetch_array($result_mailing))
{
if($row_mailing['sammel']==0)
{
$sammeln = "";
} else
{
$sammeln = "/sammel";
}
$ordner = date("Y_m_d",time());
$file_name = $ordner."/".$row_mailing['dplz']."".$sammeln."/".$row_mailing['data_name'].".txt";
echo("
".$file_name);
$file = $row_mailing['data_name'].".txt";
$attachment = $mail->getFile($file_name);
$mail->addAttachment($attachment, $file, 'text/plain');
}
$text = "PLZ-Bereich:".$row_plzgesamt['gesamtplz'];
$mail->setText($text);
$mail->setFrom('rechnung@wirbringenes.de');
$result = $mail->send(array($row_mailing['email']));
echo $result ? 'Mail sent!' : 'Failed to send mail';
}
mysql_close();
Zweiter COde funktioniert nicht. Kann mir einer sagen wieso???
Als Fehlermeldung erhalte ich immer:
No recipient addresses found in header
Vielen Dank
Euer 18inch