Pregunta

For some reason, if I use the following code, only one image seems to get sent:

$sql = mysql_query("SELECT photo FROM article_info");
while($row = mysql_fetch_assoc($sql)) {
    $mime->addHTMLImage($row['photo']);
}

But if I were to manually enter each image:

$mime->addHTMLImage("path_to/image1.jpg");
$mime->addHTMLImage("path_to/image2.jpg");

Both images will be sent. Now what's interesting is that with the first piece of code, the image that gets sent though email is image2.jpg. Like if for some reason, $mime gets overwritten, or something. Am I doing something wrong? Why would I only be sending/receiving one image? Any suggestions? Thanks in advance.

No hay solución correcta

Otros consejos

You need to specify the name of the image as third parameter. Currently, the name is empty and thus you overwrite the image-without-a-name with the new image-without-a-name.

http://pear.php.net/manual/en/package.mail.mail-mime.addhtmlimage.php

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top